Splash Screen
- 4 minutes to read
The Splash Screen Manager allows you to create different splash screens. The image below is a splash screen you can create and customize at design time.
The main features include:
- Non-skin-dependent appearance.
- Design-time customization.
- Automatically display and close at the main form’s startup.
- Use commands to interact with splash forms.
Create and Customize Splash Screen at Design Time
Drop the SplashScreenManager component onto the form.
Right click the component in the Visual Studio tray and select Add Splash Screen
.
The SplashScreenManager adds a new SplashScreen form to your project.
Double-click the SplashScreen1.cs (SplashScreen1.vb) file to open the design-time editor.
You can change the layout of controls within the Splash Screen, remove or add custom controls, change default labels and images, and more.
Note
If you need to extend SplashScreen1.cs/.vb files with custom classes, ensure that the class encapsulating your Splash Screen is defined before declaring your custom classes.
Show and Close Splash Screen Automatically on Main Form Startup
To display the created Splash Screen 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 will automatically display the active Splash Screen on your main form’s startup and close it when your main form has been completely initialized and displayed.
Note
You can communicate with the displayed SplashScreen as follows:
- Use methods of a SplashScreenManager instance if you display the SplashScreen using this instance.
- Use the static methods of the SplashScreenManager class if you display the SplashScreen using a static method.
Splash Screen Settings
In automatic mode, you can access and customize splash screen settings from the properties of the SplashScreenManager component.
DPI Settings
In v20.2+, Splash Screens are automatically scaled according to the current DPI settings (see Project Settings) when shown on application startup.
In previous versions, if you use a DevExpress form as the main application form, the DPI settings are applied automatically. However, if you show a Splash Screen before the main form, these settings are not applied automatically. To take the DPI settings into account, call the WindowsFormsSettings.LoadApplicationSettings method before the Splash Screen is displayed (for example, in the Splash Screen’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();
}
}
Show and Close Splash Screen in Code
Create a Splash Screen at design time in Visual Studio. You can do this with one of the following methods:
- Using the Splash Screen Manager component (see above).
- Using the Template Gallery.
Tip
If your form contains a Splash Screen Manager component, ensure that its “Active Splash Form” is set to ‘(None)’ in the smart tag menu.
To display and close an existing Splash Screen, use the static SplashScreenManager.ShowForm and SplashScreenManager.CloseForm methods.
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(typeof(SplashScreen1));
//...
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
Splash Screen Settings
The SplashScreenManager.ShowForm method overloads allow you to specify the form’s location, set the delay to display the form, enable fade-in and fade-out effects, and more.
Note
Fade-in and fade-out effects are disabled if Remote Connection Optimization mode is enabled. See this property for more details: WindowsFormsSettings.OptimizeRemoteConnectionPerformance.
To display the Splash Screen above all other forms, enable the SplashScreen.TopMost property.
Tip
See the following topic for information on how to execute code when your application starts: How to: Perform Actions On Application Startup.
Update Splash Screen Dynamically
Splash screens are displayed in a separate thread. You can use the SplashScreenManager.SendCommand method to interact with the active Splash Screen (for instance, update its contents). To process commands sent by this method, override the SplashScreen.ProcessCommand method.