Splash Screen Form
- 4 minutes to read
The Splash Screen Manager allows you to create different splash screens. This topic describes how to create, customize, and display the DevExpress Splash Screen Form.
Features include:
- Skin-independent appearance.
- Design-time customization.
- Display and close the Splash Screen Form at the main form’s startup (automatically).
- Command-related APIs to interact with Splash Screen Forms.
- High-DPI support (DirectX).
Create and Customize Splash Screen at Design Time
- Drop the SplashScreenManager component onto the form.
Click the
SplashScreenManager
component to open its smart tag menu. SelectAdd Splash Screen
.SplashScreenManager
automatically adds a new SplashScreen form to your WinForms project and assigns the Splash Screen Form to the SplashScreenManager.ActiveSplashFormTypeInfo property.Double-click the SplashScreen1.cs (SplashScreen1.vb) file to open the design-time editor.
Rearrange controls on the Splash Screen Form, remove or add controls, and change labels and images to suit your design preferences. The following screenshot shows how to change the default image:
Note
To extend SplashScreen1.cs/SplashScreen1.vb files with custom classes, define a class that encapsulates your Splash Screen before declaring custom classes.
Show and Close Splash Screen Automatically on Main Form Startup
Open the SplashScreenManager’s smart tag menu and ensure that the Active Splash Form setting is set to your Splash Screen Form (in the Properties window, use the SplashScreenManager.ActiveSplashFormTypeInfo property).
The Splash Screen Manager automatically displays the active Splash Screen Form on your main form’s startup and closes the Splash Screen Form after the main form is initialized and displayed.
Show and Close Splash Screen in Code (On Demand)
Note
If your form contains a Splash Screen Manager component, open its smart tag menu and ensure that the Active Splash Form setting is set to ‘(None)’.
Use SplashScreenManager.ShowForm and SplashScreenManager.CloseForm static methods to display and close a Splash Screen Form (the Splash Screen Form must exist in your project):
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(typeof(SplashScreen1));
//Perform 'time-intensive' operations.
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
The SplashScreenManager.ShowForm overloaded methods allow you to specify the Splash Screen Form’s location, specify the delay to display the form, enable fade-in and fade-out effects, and more.
To display the Splash Screen Form above other forms, enable the SplashScreen.TopMost
option.
Fade-in and fade-out effects are disabled if Remote Connection Optimization mode is enabled.
Tip
Use our Template Gallery: Splash Screen to quickly add a Splash Screen Form to your WinForms project.
Splash Screen Settings
In automatic mode (when the Main Form displays the Splash Screen Form on startup), use properties of the SplashScreenManager component to customize splash screen settings:
DPI Settings
In v20.2+, Splash Screen Forms are automatically scaled according to DPI settings (when displayed on application startup).
In versions prior to v20.2, if you use a DevExpress form as the main application form, DPI settings are applied automatically. However, if you show a Splash Screen Form before the main form, these settings are not applied automatically.
To take DPI settings into account, call the WindowsFormsSettings.LoadApplicationSettings method before the Splash Screen Form is displayed (for example, in the Splash Screen Form’s constructor):
using DevExpress.XtraEditors;
using DevExpress.XtraSplashScreen;
public partial class SplashScreen1 : SplashScreen {
public SplashScreen1() {
WindowsFormsSettings.LoadApplicationSettings();
InitializeComponent();
this.labelCopyright.Text = "Copyright © 1998-" + DateTime.Now.Year.ToString();
}
}
Update Splash Screen Dynamically
Splash Screen Forms are displayed in a separate thread.
Use the SplashScreenManager.SendCommand method to interact with the active Splash Screen Form (for example, update form content).
Override the SplashScreen.ProcessCommand method to process commands sent by the SendCommand
method.