471,319 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,319 software developers and data experts.

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
Dec 22 '05 #1
4 8951
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

Dec 22 '05 #2
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(object sender, System.EventArgs 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.EventArgs 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

Dec 22 '05 #3
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" <sg*******@clear.net.nz> wrote in message
news:43********@clear.net.nz...
Howdy folks,
How would one go about making a splash screen (message appearing while
main program loading) in c#
cheers in advanced

Steve

Dec 22 '05 #4
Hi,

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

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


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
Dec 22 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by andrewcw | last post: by
2 posts views Thread by Joe Cool | last post: by
1 post views Thread by Ken Allen | last post: by
10 posts views Thread by =?Utf-8?B?UmljaGFyZCBCeXNvdXRo?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.