How to make a splash screen. December 8, 2005
Posted by Christian López Espínola in CSharp, Programming.trackback
When we execute some applications, we see a splash screen with the logo of the program on it.
The computer user thinks that if there’s no new window in his monitor, computer is not working.
By that, we should show something when the application is loading his data structures.
How can we make it? Using threads. In CSharp we have to include the System.Threading namespace.
At our Main function we have to declare a thread like follows:
Thread th= new Thread (new ThreadStart(Splash));
Splash is an static function we will see later.
Then we start thread’s execution, and we initialize our structures. After that, we kill the secondary thread:
th.Start();
//initialize structures…
th.Abort();
Finally we start our main window:
Application.Run(mainForm);
Our Splash function could be like follows:
public static void Splash()
{
SplashForm sf = new SplashForm();
sf.ShowDialog();
}
If our structures load fast, the splash screen will not can visible. We can make it visible with a thread sleep. The time that thread sleeps is taken in milliseconds:
Thread.Sleep(4000);
Now our applications will seem more professional.
Good article.
SPUNK MUFFINS
thanks
for turkish(teşekkür ediyorum, minnettarız)
@isim
I had to ask to a turkish friend…
You are welcome, and thanks for commenting
If you want to follow me, I’m now at http://penyaskitodice.wordpress.com
thanks for the article,its great