Splash Screen is basically the first thing you see when you open any application. Primary goal of this Screen is to tell the user that application is loading and user needs to wait.
Here is the step by step guide to add Splash Screen to Windows Forms Application using programming language C#.
Step 1: Create a new Windows Form Application.
- Open Visual Studio 2010
- Go to File -> New -> Project
- Select Windows Form Application under c# category
- And name it as SplashScreenTry as shown below:
Step 2: Create a First Form of the Application to be displayed
- Here we will use an inbuilt form created by Windows Forms Application, Form1.cs.
- Put a label on this form by drag and dropping from Toolbox.
- Write some text to be displayed as shown below. Ex. ‘Inventory System Application’ in our case.
Step 3: Create a Splash Screen Form
- Add new form to act as splash screen by right clicking on project name(SplashScreenTry) in Solution Explorer.
- Select Add -> Windows Form.
- Name it as SplashScreen.cs
Step 4: Edit a Splash Screen Form
- Right click on Splash Screen Form design and select Properties
- Change the following properties:
- FormBorderStyle -> None
- BackColor -> Select any color OR
- You can also keep Background Image as splash screen by changing BackgroundImage property of a form.
- StartPosition -> CentreScreen
- Design a splash screen by using Text, Images etc. Usually splash screen contains the title of the Application, Version details, Owner and Developer information etc.
- Here is the splash screen we designed:
Step 5: Set this Splash Screen as Start Form
- Go to the Program.cs file
- Replace Application.Run(new Form1()) by Application.Run(new SplashScreen())
Step 6: Set the timer for a Splash Screen.
- Right click on the SplashScreen form design and go to events
- Double click on the Shown event of the form and paste this code under that.
private void splash_Shown(object sender, EventArgs e)
tmr = new Timer();
//set the timer for splash screenas 4 sec
tmr.Interval = 4000;
//to start the timer
tmr.Tick += tmr_Tick;
- Then on the same code page, paste this code outside the splash_Shown event code given above:
void tmr_Tick(object sender, EventArgs e)
//after 4 sec we stop the timer
//display first form of the application
var nextform = new Form1();
- Here Form1 is the next form to be displayed after 4 seconds of splash screen.
- Finally Save and run the application.
You may also like Install Turbo C++ for Windows and Linux
- How To Create Setup file Visual Studio C#.NET Project - September 20, 2016
- How to Create a Simple ASP.NET Website-Master Pages - September 16, 2016
- Retrieve Code C# in Visual Studio 2010 - September 15, 2016
- ASP.NET Validation for a Website-Tutorial - August 31, 2016
- Insert Code C# from Visual Studio into SQL - August 26, 2016
- How to add Splash Screen to Windows App in VS10 C# - August 20, 2016