Skip to main content
A newer version of this page is available. .

Splash Image

  • 4 minutes to read

The Splash Screen Manager allows you to display any image as a splash screen.

SplashScreen-DefaultImage

The main features include:

  • Image transparency. Splash images can have an irregular form and contain shadows.
  • Design-time customization. Allows you to display custom controls above the image.
  • Automatically display and close at the main form’s startup.
  • Allows you to custom draw over the image.
  • Interact with splash forms via commands.

Create and Show Splash Image in Code

This approach allows you to show any image as a splash screen with a single line of code. You can use a custom painter to draw over the splash image (for example, paint a progress indicator).

To invoke a splash image, call the static SplashScreenManager.ShowImage method, specifying the target image as a parameter. To hide the image, call the static SplashScreenManager.HideImage method.

Image im = Image.FromFile("mySplashScreen.png");
SplashScreenManager.ShowImage(im);
//...
SplashScreenManager.HideImage();

The SplashScreenManager.ShowImage method overloads allow you to specify the image position and enable fade animation effects.

Custom Draw Over Splash Image

To display a splash image and draw graphics over the splash image, do the following:

  • Create a class that supports the ICustomImagePainter interface.
  • Implement a paint procedure via the ICustomImagePainter.Draw method.
  • Use the ShowImage method overload with the ‘painter’ parameter and pass an ICustomImagePainter object as this parameter.

The ICustomImagePainter.Draw method is invoked each time the image is displayed. To force a splash image to update, call the SplashScreenManager.Invalidate method. See this topic for an example.

Create Splash Image at Design Time. Show It Manually or Automatically

This approach provides the following customization options:

  • Allows you to create splash images at design time.
  • Automatically show and close splash images on the main form’s startup.
  • Show and close splash images in code.
  • Add custom controls over the splash image.
  • Access and extend the implementation of the splash image class.
  • Use commands to interact with the splash image in code.

Create Splash Image

Right click the SplashScreenManager component in the Visual Studio tray and select Add Splash Screen.

Double-click the generated SplashScreen1.cs (SplashScreen1.vb) file in the Solution Explorer to open the design-time editor.

Set the SplashScreen‘s ShowMode property to Image.

splashscreen-changemode

You can also use the SplashScreen.SplashImageOptions property to specify a custom image.

Add Custom Controls Over Image

To display custom controls above the image:

Note

If you need to extend SplashScreen1.cs/.vb files with custom classes, ensure that the class encapsulating your Splash Screen goes first in these files.

Automatically Show and Close on Startup

To automatically display the created Splash Image on your main form’s startup, ensure the SplashScreenManager’s Active Splash Form is set to your splash screen. Open the SplashScreenManager’s smart tag and check the Active Splash Form setting.

Alternatively, you can check the SplashScreenManager.ActiveSplashFormTypeInfo setting in the Property Grid.

The Splash Screen Manager automatically displays the active Splash Screen on your main form’s startup and closes it when your main form was initialized and displayed.

Manually Show and Close

Ensure that the Splash Screen Manager’s Active Splash Form is set to ‘(None)’.

To display and close the created Splash Screen, use the static SplashScreenManager.ShowForm and SplashScreenManager.CloseForm methods.

SplashScreenManager.ShowForm(typeof(SplashScreen1));
//...
SplashScreenManager.CloseForm();

Update Splash Screen Dynamically

Splash screens are displayed in a separate thread. In code, you can interact with the active Splash Screen (for instance, dynamically update custom controls) via commands sent by the SplashScreenManager.SendCommand method. To process these commands, override the SplashScreen.ProcessCommand method.

See Also