Loading...
Loading...
Implement Syncfusion WinForms SplashControl to display splash screens during application startup. Use this when building startup screens, loading screens, timed splash displays, or animated splash images in WinForms. Covers SplashControl setup, image configuration, timing, animation, and positioning.
npx skill4agent add syncfusion/winforms-ui-components-skills syncfusion-winforms-splash-controlusing Syncfusion.Windows.Forms.Tools;
public partial class Form1 : Form
{
private SplashControl splashControl1;
public Form1()
{
InitializeComponent();
// Initialize SplashControl
this.splashControl1 = new SplashControl();
// Set the splash image
this.splashControl1.SplashImage = Image.FromFile("splash.png");
// Configure basic properties
this.splashControl1.HostForm = this;
this.splashControl1.TimerInterval = 3000; // Display for 3 seconds
this.splashControl1.AutoMode = true; // Auto-display on form load
this.splashControl1.DesktopAlignment = SplashAlignment.Center;
// Optional: Enable animation
this.splashControl1.ShowAnimation = true;
}
}// Display splash screen manually
private void ShowSplashButton_Click(object sender, EventArgs e)
{
// Show splash and disable owner form
splashControl1.ShowSplash(true);
}
// Hide splash screen programmatically
private void HideSplashButton_Click(object sender, EventArgs e)
{
splashControl1.HideSplash();
}
// Show as modal dialog
private void ShowModalSplash_Click(object sender, EventArgs e)
{
splashControl1.ShowDialogSplash(this);
}private void InitializeSplash()
{
splashControl1.HostForm = this;
splashControl1.SplashImage = Properties.Resources.CompanyLogo;
splashControl1.AutoMode = true;
splashControl1.HideHostForm = true;
splashControl1.TimerInterval = 4000;
splashControl1.DesktopAlignment = SplashAlignment.Center;
// Handle splash closed event to perform initialization
splashControl1.SplashClosed += (s, e) =>
{
// Perform app initialization after splash closes
LoadApplicationData();
};
}private void SetupCustomSplashPanel()
{
// Create and design SplashPanel
SplashPanel splashPanel = new SplashPanel();
splashPanel.BackgroundColor = new BrushInfo(GradientStyle.Vertical,
Color.White, Color.LightBlue);
splashPanel.Size = new Size(400, 200);
// Add label
Label statusLabel = new Label
{
Text = "Loading Application...",
AutoSize = true,
Location = new Point(50, 80),
Font = new Font("Segoe UI", 14, FontStyle.Bold)
};
splashPanel.Controls.Add(statusLabel);
// Configure SplashControl to use custom panel
splashControl1.CustomSplashPanel = splashPanel;
splashControl1.UseCustomSplashPanel = true;
splashControl1.HostForm = this;
splashControl1.TimerInterval = 5000;
}private void ConfigureSplashEvents()
{
splashControl1.BeforeSplash += (s, e) =>
{
// Log before display
Debug.WriteLine("Splash screen about to display");
// Cancel if needed
// e.Cancel = true;
};
splashControl1.SplashDisplayed += (s, e) =>
{
Debug.WriteLine("Splash screen is now visible");
StartBackgroundInitialization();
};
splashControl1.SplashClosing += (s, e) =>
{
Debug.WriteLine("Splash screen is closing");
};
splashControl1.SplashClosed += (s, e) =>
{
Debug.WriteLine("Splash screen closed");
ShowMainForm();
};
}private void ConfigureTransparentSplash()
{
splashControl1.SplashImage = Properties.Resources.LogoWithTransparency;
splashControl1.TransparentColor = Color.White; // Make white pixels transparent
splashControl1.ShowAnimation = true;
splashControl1.ShowAsTopMost = true;
splashControl1.DesktopAlignment = SplashAlignment.Center;
splashControl1.TimerInterval = 3000;
}| Property | Type | Description |
|---|---|---|
| AutoMode | bool | Automatically display splash on form load |
| SplashImage | Image | Image to display as splash screen |
| TimerInterval | int | Display duration in milliseconds (default: 5000) |
| DesktopAlignment | SplashAlignment | Position on desktop (Center, SystemTray, corners, Custom) |
| HostForm | Form | Parent form of the SplashControl |
| HideHostForm | bool | Hide parent form during splash display |
| ShowAnimation | bool | Enable left-to-right animation effect |
| CustomSplashPanel | SplashPanel | Custom panel to display instead of image |
| UseCustomSplashPanel | bool | Use CustomSplashPanel instead of SplashImage |
| AutoModeDisableOwner | bool | Display splash modally in AutoMode |
| ShowAsTopMost | bool | Display splash as topmost window |
| TransparentColor | Color | Color to make transparent in splash image |
| IsShowing | bool | Indicates if splash is currently displayed (read-only) |
| Method | Description |
|---|---|
| ShowSplash(bool disableOwner) | Display splash screen manually |
| HideSplash() | Close the splash screen programmatically |
| ShowDialogSplash(Form owner) | Display splash as modal dialog |
| ShowDialogSplash(Point location, Form owner) | Display splash at specific location as modal |
| Event | Description |
|---|---|
| BeforeSplash | Raised before splash display (cancelable) |
| SplashDisplayed | Raised after splash is shown |
| SplashClosing | Raised before splash closes (cancelable) |
| SplashClosed | Raised after splash is closed |
Syncfusion.Shared.Base.dllSyncfusion.Tools.Windows.dllInstall-Package Syncfusion.Tools.Windows