views:

1037

answers:

5

I'm going to input a splash screen to an application I'm currently working on that only consists of one form which we will call frmMain for now. I want to implement a splash screen (frmSplash) but need advice as to what would be the best way to implement it. The purpose of the splash screen will be to load necessary settings into textboxes, checkboxes, etc. based on the last settings of when the program was last closed. Here's my question.

Should I let the main form load, but keep it invisible to the user and then call the splash screen which will run and then load all the settings into the main form?

If so how would I do the above? Load the frmSplash in the frmMain_Load event? I plan to keep the splash screen visible for at least 3 seconds. How would I give it the pause effect so that it stays up for 3 seconds while it recovers the settings from the settings file?

+4  A: 

Yes, it is a good practice to use a splash screen to hide form initialization. Here is a pretty good tutorial that should get you up and running:

Creating a Splash Screen in C#

Andrew Hare
+1  A: 

I would suggest going the other way. Have frmSplash start up, parse the settings and pass them on to a new hidden frmMain. And once frmMain has finished loading (or after 3 seconds) show it.

Or just have the splash screen create a hidden frmMain and show it once it's done loading and in a valid state.

Samuel
+3  A: 

It's probably cleaner not to load the settings in the splash form, but to keep that just for display. Display the splash form and load the settings in the main form.

dommer
+1  A: 

There's an example here, and one with better explanations here.

Note that neither of these examples perform any kind of "pre-loading", but you can do all that in the main thread while the splash thread is doing its eye-candy work.

Hopefully this is the kind of thing you're looking for. Good luck!

Mike
+1  A: 

Here's a canned version you can try: Autorun Action Splash

Boydski