Splash Screen

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steve

    Splash Screen

    Howdy folks,


    How would one go about making a splash screen (message appearing while main
    program loading) in c#


    cheers in advanced



    Steve


  • Steven Nagy

    #2
    Re: Splash Screen

    In your main form constructor, hide the main form.
    Create your splash screen form instance and show it with Form.Show()
    (not ShowDialog)
    Continue with your initialisation code.
    When your code is complete, close the splash screen with Form.Close()
    and probably dispose it as well.
    Show the main form again with this.Show()

    You could also do it in the main static method. Show slash form,
    initialise, show main form.

    Thats the theory anyway!

    Steven Nagy

    Comment

    • gsb58@hotmail.com

      #3
      Re: Splash Screen

      Here's an example. The splash form is made transparent with a bee, so
      when it loads, only the bee is visible. Then a timer, in frmSplash,
      will close the form after 1375 ms. The bee will "fly" away to the upper
      left corner and finally disappear.

      However, is there a better way to animate the bee than my example?

      The code in frmSplash:

      private void timer1_Tick(obj ect sender, System.EventArg s e)
      {
      this.Left = 400;
      this.Top = 300;
      this.Left = 375;
      this.Top = 275;
      this.Left = 350;
      this.Top = 225;
      this.Left = 300;
      this.Top = 200;
      this.Left = 250;
      this.Top = 150;
      this.Left = 200;
      this.Top = 100;
      this.Left = 100;
      this.Top = 75;
      this.Left = 50;
      this.Top = 10;
      this.Left = 0;
      this.Top = 0;
      Close();
      }

      private void frmSplash_Load( object sender, System.EventArg s e)
      {
      timer1.Enabled = true;
      }

      And in frmMain:

      [STAThread]
      static void Main()
      {
      ///start splash-form for application
      Application.Run (new frmSplash());

      ///start main-form
      Application.Run (new frmMain());
      }

      Me.Name

      Comment

      • Ignacio Machin \( .NET/ C# MVP \)

        #4
        Re: Splash Screen

        Hi,

        If you google you will find several examples of a splash screen , this
        question is posted here on a regular basis


        --
        Ignacio Machin,
        ignacio.machin AT dot.state.fl.us
        Florida Department Of Transportation


        "Steve" <sgladding@clea r.net.nz> wrote in message
        news:43aa0bb0$1 @clear.net.nz.. .[color=blue]
        > Howdy folks,
        >
        >
        > How would one go about making a splash screen (message appearing while
        > main program loading) in c#
        >
        >
        > cheers in advanced
        >
        >
        >
        > Steve
        >[/color]


        Comment

        • Ignacio Machin \( .NET/ C# MVP \)

          #5
          Re: Splash Screen

          Hi,
          [color=blue]
          >
          > [STAThread]
          > static void Main()
          > {
          > ///start splash-form for application
          > Application.Run (new frmSplash());
          >
          > ///start main-form
          > Application.Run (new frmMain());
          > }
          >[/color]

          What happens if frmMain loads before the timeout? , how does it close the
          splash?


          --
          Ignacio Machin,
          ignacio.machin AT dot.state.fl.us
          Florida Department Of Transportation


          Comment

          Working...