Jump to content

cbox


Creating a SplashScreen in C#


xXxStevenxXx

Recommended Posts

Posted

1.) Let's start by creating a new C# Windows Application ( File -> New -> Project -> Windows Application ). Name the project SplashScreen.

 

2.) Let's leave the current form the way it is and add to our project another form. To do this, go to Project menu and click Add Windows Form. Name the class Splash.cs and click OK.

 

3.) Let's set the Slash Form FormBorderStyle to None its StartPosition to CenterScreen.

 

4.) Be sure to add this

using System.Threading;

on your Form1

 

5.) Now go to Form1() method. Add The following code right bellow the call to InitializeComponent method

Thread th = new Thread(new ThreadStart(DoSplash));
th.Start();
Thread.Sleep(3000);
th.Abort();
Thread.Sleep(1000);

This let the SplashScreen sits for 3 sec then another sec so thats 4 sec before the Form1 shows.

 

 

6.) Now lets make the DoSplash Command. Put this following code anywhere in your Form1

 private void DoSplash()
{
Splash sp = new Splash();
sp.ShowDialog();
}

 

And Your Done Enjoy I will include an project file

SplashScreen.rar

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...