Making An Introductory Splash Screen For A Windows Desktop Application in C#

INTRODUCTION

Have you ever wondered what a software developer does to create a splash screen for a program? I would like to discuss the method I use to create one for my desktop application development projects.

I use an unusual design for my splash screen. It consists of an ellipse enclosed in a silver colored rectangle. Inside the ellipse are some shaded, green vertical bars that resemble columns interspersed with a black background. The text information pertaining to the program is then centered in the middle and on top of the green and black color patterns.

THE C# CODE THAT CREATES THE SPLASH SCREEN PICTURE

The “SplashForm” Windows form contains the C# code that creates an “image-on-the-fly of the splash picture” that is sent to the screen. Please click here to see the web page I made for this. Just click on the “Agree” button to view the full C# programming code.

The platform I use for this is Microsoft Visual Studio Express 2012 for Windows Desktop. In the Program.cs file of the project, I use this code in the main module:

  1.  static void Main()  
  2.   
  3. {  
  4.   
  5.     Application.EnableVisualStyles();  
  6.   
  7.     Application.SetCompatibleTextRenderingDefault(false);  
  8.   
  9.     // run splash screen.  
  10.   
  11.     Application.Run(new SplashForm());  
  12.   
  13.     // run main menu.  
  14.   
  15.     Application.Run(new MainForm());  
  16.   

 
After initially running the C# (CSharp) application to display the preceding image using the “image-on-the-fly of the splash picture”, I was able to capture it with Snagit Windows Screen Capture Utility version 11. This is made by a company called TechSmith at “http://www (dot) techsmith (dot) com/”. Next, I uploaded the "saved capture image" to The Free Online Image Editor at “http://www (dot) online-image-editor (dot) com/”. I used this utility to do some minor cropping of the image border before I downloaded it in its present form.

ASSEMBLING THE WINDOWS FORM SPLASH SCREEN

Now that the splash screen image is done, it is time to finish putting the splash screen together. Here I present the C# code from the “SplashForm” Windows form that sets the splash screen timer for 5 seconds. It is then closed and the main program screen with its menu bar will appear. Also, the coding under the form's “Activated event” used to create the “image-on-the-fly of the splash picture” can now be suppressed or removed at this point. This is no longer needed since we now have the splash screen image that will be bound to the “SplashForm” Windows form.

  1. // this code creates a 5 second time interval, which  
  2.   
  3. // will keep the splash screen visible for that time  
  4.   
  5. // interval before it is closed and the main program  
  6.   
  7. // screen appears with its menu bar.  
  8.   
  9. public partial class SplashForm : Form  
  10.   
  11. {  
  12.   
  13.    System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();  
  14.   
  15.    public SplashForm()  
  16.   
  17.    {  
  18.   
  19.       InitializeComponent();  
  20.   
  21.       SetAndStartTimer();  
  22.   
  23.    }  
  24.   
  25.   
  26.    private void SetAndStartTimer()  
  27.   
  28.    {  
  29.   
  30.      t.Interval = 5000;  
  31.   
  32.      t.Tick += new EventHandler(t_Tick);  
  33.   
  34.      t.Start();  
  35.   
  36.    }  
  37.   
  38.   
  39.    void t_Tick(object sender, EventArgs e)  
  40.   
  41.    {  
  42.   
  43.      this.Close();  
  44.   
  45.    }  
  46.   
  47.    .  
  48.   
  49.    .  
  50.   
  51.    .  
  52.   
  53.    .  
  54.   
  55.    .  
  56.   
  57.   // the form's activated event appears after this  
  58.   
  59.   // set up stuff in the actual code to create the  
  60.   
  61.   // “image on the fly of the splash picture” to be  
  62.   
  63.   // used for creating the splash screen (it will be  
  64.   
  65.   // captured by the Snagit screen capture utility).  
  66.   

 
Upon opening the C# project, we need to select the “SplashForm” Windows Forms form from the “Solution Explorer” on the right hand side. If the “Properties” pane does not open directly beneath the “Solution Explorer” pane, then right-click on the “SplashForm” Windows Forms form on the left side to bring up the pop-up menu and select “Properties”. Now we need to configure the following properties of the “SplashForm” Windows Forms form to complete the splash screen for the C# project:
  • BackgroundImage: Choose the splash screen image previously created with the Snagit Windows Screen Capture Utility.
  • FormBorderStyle: Choose the option “None”.
  • Size: Key in the width in pixels then a comma followed by the height in pixels of the splash screen image.
  • StartPosition: Choose the option “CenterScreen”.

Lastly, from the menu bar in Microsoft Visual Studio Express 2012 for Windows Desktop, click the “Build” option and then select from its pop-up menu the “Rebuild Solution” item. This will check the C# project for any coding errors and generate a new executable so the application can be run with the newest updates.

CONCLUSION

What I have presented here is a 2 step process for creating an introductory splash screen from scratch for Microsoft Visual Studio Express 2012 for Windows Desktop projects. Although the graphic image design can vary from what I chose for myself, the chronological steps remain the same. I'm not saying this is the best way to proceed, but it seemed to work fine for my purposes. There is an almost endless way to use one's developer skills to arrive at the same programmed solution.