How to Create a Metro Splash Screen in C#

By FoxLearn 7/20/2024 2:34:14 AM   9.63K
To create a Metro splash screen with a Metro progress bar using Metro Framework in a C# Windows Forms Application, you'll need to follow these steps.

Create a new Windows Forms Application project, then enter your project name is "MetroSplashScreen" and click OK button.

How to create a metro splash screen in C#

To make a metro form, you should install the metro framework by right-clicking on your project, then select Manage NuGet Packages, you need to search metro framework and install it on your project.

If you don't see the metro framework in your Visual toolbox, you can view How to download and install metro framework

Drag and drop PictureBox, MetroProgressBar, MetroLabel controls from Visual Studio toolbox to your windows forms application, then design a simple splash screen form as shown below.

c# metro splash screen

To create a metro form, you need to create frmMain, frmSplashScreen form, then change inherit from Form to MetroForm as the following c# code.

public partial class frmSplashScreen : Form

to

public partial class frmSplashScreen : MetroFramework.Forms.MetroForm

Do the same way for the frmMain form.

Add code to handle your Main form as shown below allows you to call the SplashScreen form in new theard.

public partial class frmMain : MetroFramework.Forms.MetroForm
{
    public frmMain()
    {
        Thread t = new Thread(new ThreadStart(Loading));
        t.Start();
        InitializeComponent();
        for (int i = 0; i <= 1000; i++)
            Thread.Sleep(10);//Only for demo
        t.Abort();//Complete
    }

    //Start splash screen
    void Loading()
    {
        frmSplashScreen frm = new frmSplashScreen();
        Application.Run(frm);
    }
}

You can use Thread.Sleep method to delay process. in real world, your data will be processed there.

VIDEO TUTORIAL