Windows Forms Application C# - Splash Screen With Metro Framework

In this article, we will discuss how to create a splash screen using Metro Framework step-by-step. We will create a progress bar to load any process in a Windows.Forms application. The splash screen actually displays at the process running time.

Metro framework

It is an open-source DLL that is used to create a high-level Windows.Forms application. It has its own development tools which are used for designing and making the Windows.Forms a clear and high-quality UI theme.

Let's begin

Step 1

Create a new project in Visual Studio as in the following.

 

Step 2

Add Reference file and right click. Go to Add >> Manage NuGet Package. Click >> Browse (Metro Frame). It will be downloaded automatically. It will have a collection of own tools to be used to UI design.

Step 3

Add another form that will be used as the splash screen for this project, as in the following.

 

Step 4

Add a picture box to the frmSplashScreen.cs form using the toolbox. Actually, I am using an image for the splash screen (you can try something different). Import the file and save it.



Step5

Add the progress bar and label in Toolbox and change the Progress Bar Properties (such as Marquee) and Change Label Properties (such as Processing).



 

Step 6

Go to (Splash Screen Form) and write the following C# Code, in a proper manner with Splash() and Loading(), as shown below.

Header File

Using System.Threading;

C# Code
  1. namespace Splashscreen {  
  2.     public partial class Splash: MetroFramework.Forms.MetroForm {  
  3.         public Splash() {  
  4.             Thread t = new Thread(new ThreadStart(Loading));  
  5.             t.Start();  
  6.             InitializeComponent();  
  7.             for (int i = 0; i <= 1000; i++) Thread.Sleep(10);  
  8.             t.Abort();  
  9.         }  
  10.         void Loading() {  
  11.             frmSplashScreen frm = new frmSplashScreen();  
  12.             Application.Run(frm);  
  13.         }  
  14.     }  
  15. }  
Step 7

Go to Program.cs form and write the following C# code. Change the application run form name as new frmsplashscreen() as shown below.

Step 8

Press F5 or "Build and Run" the application.

 

Finally, we have successfully created Windows.Forms application for Splash Screen with Metro Framework.