#1,104 – How the Splash Screen Works

You can configure a splash screen in a WPF application by adding an image to the solution and setting its build action to SplashScreen.  The image will appear while the application is loading and then disappear as soon as the main window appears.

You can see how the splash screen works by looking at the code generated at build time for your main application class.  This will be in a file that looks something like App.g.cs.

To open the file, enable the Show All Files option and then look for App.g.cs under the obj directory.

1104-001

In the Main method, a SplashScreen instance is created and the name of the image is passed to its constructor.  It’s Show method is called and then the normal Application initialization is done. The Show method accepts a boolean indicating that the splash screen should be hidden once the main window is shown.

1104-002

 

Advertisement

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #1,104 – How the Splash Screen Works

  1. Pingback: Dew Drop – July 2, 2014 (#1806) | Morning Dew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: