1 out of 1 rated this helpful - Rate this topic

SplashScreen Class

Provides a startup screen for a Windows Presentation Foundation (WPF) application.

System.Object
  System.Windows.SplashScreen

Namespace:  System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)
[UIPermissionAttribute(SecurityAction.LinkDemand, Window = UIPermissionWindow.AllWindows)]
public class SplashScreen

The SplashScreen type exposes the following members.

  Name Description
Public method SplashScreen(String) Initializes a new instance of the SplashScreen class with the specified resource.
Public method SplashScreen(Assembly, String) Initializes a new instance of the SplashScreen class with the specified resource assembly.
Top
  Name Description
Public method Close Closes the splash screen.
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Show(Boolean) Displays the splash screen.
Public method Show(Boolean, Boolean) Displays the splash screen.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Top

Use the SplashScreen class to show an image in a startup window, or splash screen, when a WPF application starts. Call the Show method to display the splash screen. Call the Close method to close the splash screen. Specify the image to use in the SplashScreen constructor.

The SplashScreen class can display any image format that is supported by the Windows Imaging Component (WIC). For example, you can use the BMP, GIF, JPEG, PNG, or TIFF format. If the image is a PNG file and it includes an alpha channel, the image is rendered using the transparency defined in the alpha channel.

You cannot include placeholder text in the splash screen that is later added by your code. If you want to include text in the splash screen, you must add it to the image file.

Note Note

It is not necessary to write any code to display a splash screen. Starting in Visual Studio 2008 SP1, you can quickly configure a splash screen with default settings. For more information, see How to: Add a Splash Screen to a WPF Application.

The SplashScreen class displays the splash screen as soon as possible after the application is started. The splash screen is displayed by using native code, before the WPF application instance is created. The splash screen is displayed in the center of the screen. When the application is loaded, the splash screen fades.

When your application is compiled, the image is embedded as a managed resource in the assembly. If the application is localized, the image is embedded in the localized satellite DLL.

Note Note

The SplashScreen class is not available in partial trust.

Note Note

The SplashScreen class cannot be used in XAML Browser Applications (XBAPs), because they use a different startup architecture.

The following code example shows how to create and display a startup window by using the SplashScreen class.


SplashScreen splashScreen = new SplashScreen("SplashScreenImage.bmp");
splashScreen.Show(true);

// Run the application.


.NET Framework

Supported in: 4, 3.5 SP1, 3.0 SP2

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
  • SecurityPermission  

    for access to unmanaged resources. Security action: LinkDemand. Associated enumeration: UIPermissionWindow.AllWindows

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
How to display a splash screen for at specific minimum length of time in WPF
$0We found that on some machines the splash screen is a “must have” because the application load time was greater than two seconds. In fact, it was so long that without the splash screen, the user thought the program didn’t start and clicked it again. So a splash screen was added the default way.$0 $0However, on newer and faster machines, the application load time was less than half a second. For these newer and faster devices, the splash screen loads and closes so quickly it is awkward.$0 $0It would actually be better to always have the splash screen show for a minimum of two seconds whether the machine is fast or slow.$0 $0I solved this with a mix of SplashScreen and StopWatch and posted a solution here.$0 http://www.wpfsharp.com/2012/02/14/how-to-display-a-splash-screen-for-at-specific-minimum-length-of-time-in-wpf/$0