1. Computing

Creating a Splash Screen

Let the user know the program is in the process of loading...

By

The most basic splash screen is just an image (more precisely a form with an image) that appears in the center of the desktop screen when the application is loading (and gets hidden when the application is ready for usage).

Splash Screen?

There are several types of Splash Screens. The most common splash screens are start up splash screens. The ones you see when an application is loading. These usually display the application's name, author, version, copyright, and image or some icon that uniquely identifies it. If you are a shareware developer, you could use splash screens to remind users to register the program. Some applications use splash screens to display and notify the user of the progress of a time-consuming process (don't want users to think that your program is "dead" if some database task is performing).

Splash Screen!

Let's see how to create a simple start up SplashScreen in a few steps:
  1. Add a new form to your project (select New Form from the File menu in the Delphi IDE).

  2. Change the Name Property of the Form to something like SplashScreen.

  3. Change these Properties: BorderStyle to bsNone, Position to poScreenCenter.

  4. Customize your Splash Screen by adding various components: labels, images, panels, etc. You could first add one TPanel component (Align: alClient), and play around with BevelInner, BevelOuter, BevelWidth, BorderStyle, BorderWidth properties to produce some eye-candy effects.

  5. Select Project from the Options menu and move the SplashScreen Form from the Auto-create listbox to Available Forms. We'll create a form on the fly and then displaying it before the application is actually opened.

  6. Select Project Source from the View menu. (Or, Project | View Source).

  7. Add the following code after the begin statement of the Project Source code (the .dpr file).
     
     Application.Initialize; //this line exists!
     SplashScreen := TSplashScreen.Create(nil) ;
     SplashScreen.Show;
     SplashScreen.Update; 
     
  8. After the final Application.Create() and before Application.Run statement add:
     
     SplashScreen.Hide;
     SplashScreen.Free;
    
  9. That's it. Now run the application. In this example, depending on the speed of your computer, you will barely see your new Splash Screen, but if you have more than one form in your project, the splash screen will certainly show up!

  10. Ah yes, why have rectangular splash screen forms? Create a custom shaped Delphi form!

©2014 About.com. All rights reserved.