How to Create a Splash Screen in C#
By FoxLearn 8/27/2024 1:43:54 AM 22.02K
How to create a Splash Screen in C#
Creating a simple loading screen c# by using the SplashScreen library. So, to play the demo you should install the SplashScreen.dll by right-clicking on your project, then selecting Manage NuGet Packages -> Search 'splash screen' -> Install
C# splash screen while loading
The SplashScreen library is an open source that helps you create a simple splash screen in c# windows forms application.
Open your main form, then modify your c# code as show below to allow you to start a new thread to run your splash screen form.
//splash screen thread c# public frmMain() { Thread t = new Thread(new ThreadStart(Splash)); t.Start(); InitializeComponent(); //Loading data string str = string.Empty; for (int i = 0; i < 100000; i++) { str += i.ToString();//Init data, only for demo } //Complete t.Abort(); }
Add your handle code below "loading data" line, to simulate data processing i'm using a loop to delay the process.
Next, Create the Splash method allows you to open the flash screen form as the following c# code.
// c# splash screen forms void Splash() { //c# open a splash screen form SplashScreen.SplashForm frm = new SplashScreen.SplashForm(); frm.Font = new Font("Time New Romans", 7); frm.AppName = "Demo"; frm.Icon = Properties.Resources.app;//Load icon from resource frm.ShowIcon = true; frm.ShowInTaskbar = true; Application.Run(frm); }
Through this c# example, you can create a simple splash screen form that helps you loading screen c# windows forms application when you're loading or processing data.
You can also add icon to the splash screen form or change the font type or font size to create the loading screen like Microsoft Office loading screen above.
VIDEO TUTORIAL