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.
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
- namespace Splashscreen {
- public partial class Splash: MetroFramework.Forms.MetroForm {
- public Splash() {
- Thread t = new Thread(new ThreadStart(Loading));
- t.Start();
- InitializeComponent();
- for (int i = 0; i <= 1000; i++) Thread.Sleep(10);
- t.Abort();
- }
- void Loading() {
- frmSplashScreen frm = new frmSplashScreen();
- Application.Run(frm);
- }
- }
- }
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.