How to set Splash Screen to window application with Timer control in C#.net


In this post I am showing about to set SplashScreen to any Windows forms application in C#.net.
For that first take one form name as SplashScreen in that take one picturebox control from toolbox and add any required image to picturebox.
Again take one form name as Login which you want to develop for your application in that add one Timer control set Timer control property Interval as 3000 then write the following code in Login.cs:

public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
            Thread th = new Thread(new ThreadStart(SplashScreen));
            th.Start();
            Thread.Sleep(3000);
            th.Abort();
            Thread.Sleep(1000);
        }
        public void SplashScreen()
        {

            SplashScreen sp = new SplashScreen();
            sp.ShowDialog();


        }
}

Run your Login form then first you will get SplashScreen Image then after Login page will come.



2 comments: