Επεξεργασία

Κοινή χρήση μέσω


SplashScreen Class

Definition

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

public ref class SplashScreen
public class SplashScreen
[System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)]
public class SplashScreen
type SplashScreen = class
[<System.Security.SecurityCritical(System.Security.SecurityCriticalScope.Everything)>]
type SplashScreen = class
Public Class SplashScreen
Inheritance
SplashScreen
Attributes

Examples

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.

Remarks

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

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

The SplashScreen class is not available in partial trust.

Note

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

Constructors

SplashScreen(Assembly, String)

Initializes a new instance of the SplashScreen class with the specified resource assembly.

SplashScreen(String)

Initializes a new instance of the SplashScreen class with the specified resource.

Methods

Close(TimeSpan)

Closes the splash screen.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
Show(Boolean, Boolean)

Displays the splash screen.

Show(Boolean)

Displays the splash screen.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also