How to Create a Splash Screen in C#

By FoxLearn 7/20/2024 2:13:48 AM   6.89K
Creating a splash screen with a progress bar in a C# Windows Forms Application involves a few steps.

How to create a Splash Screen with Progress Bar in C#

Open your Visual Studio, then click New Project, then select Visual C# on the left, then Windows and then select Windows Forms Application. Name your project "SplashScreen" and then click OK button.

Add a new form to your project, then design the splash screen form as you like.

Next, Add a background image, logo, or any other visual elements you want to display during the loading process.

Finally, Add a ProgressBar control to your splash screen form. You can design your splash screen as shown below.

splash screen in c#

Open Program.cs in your project, then change the startup form to your splash screen form.

using System.Threading;
using System.Windows.Forms;

namespace SplashScreen
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            //Create new thread to run the splash screen
            Thread t = new Thread(new ThreadStart(StartForm));
            t.Start();
            Thread.Sleep(5000);//Only for demo
            InitializeComponent();
            t.Abort();
        }

        public void StartForm()
        {
            Application.Run(new frmSplashScreen());
        }
    }
}

VIDEO TUTORIAL