syncfusion-winforms-splash-control
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImplementing Syncfusion WinForms SplashControl
实现Syncfusion WinForms SplashControl
The SplashControl component enables easy creation of professional splash screens for Windows Forms applications. Simply drag and drop the control onto your form, set an image, and the splash screen displays automatically at runtime with customizable timing, animation, and positioning.
SplashControl组件可帮助你轻松为Windows Forms应用创建专业的闪屏。只需将控件拖拽到你的窗体上,设置一张图片,闪屏就会在运行时自动展示,且支持自定义时间、动画和位置。
When to Use This Skill
何时使用本技能
Use this skill when you need to:
- Display a splash screen during application startup
- Show branding, logos, or loading information while the app initializes
- Create timed or manually-controlled splash displays
- Implement animated splash screens with visual effects
- Design custom splash panels with controls and content
- Control host form visibility during splash display
- Handle splash screen lifecycle events
- Position splash screens at specific desktop locations
当你需要完成以下需求时可使用本技能:
- 应用启动期间展示闪屏
- 应用初始化时展示品牌标识、logo或加载信息
- 创建定时或手动控制的闪屏展示效果
- 实现带视觉效果的动画闪屏
- 设计包含控件和内容的自定义闪屏面板
- 闪屏展示期间控制宿主窗体的可见性
- 处理闪屏生命周期事件
- 将闪屏定位到桌面的指定位置
Component Overview
组件概览
SplashControl provides two display modes:
- Image-based splash screen: Display a static or animated image
- Custom SplashPanel: Design a fully customizable panel with any controls
Key capabilities:
- Automatic or manual display control
- Configurable display duration with timer intervals
- Built-in animation effects (left-to-right reveal)
- Flexible desktop positioning (center, corners, system tray, custom)
- Host form visibility management
- Modal or non-modal display modes
- Transparency support
- Complete event lifecycle
SplashControl 提供两种展示模式:
- 基于图片的闪屏: 展示静态或动态图片
- 自定义SplashPanel: 设计完全可自定义的面板,支持添加任意控件
核心能力:
- 自动或手动控制展示
- 可配置的展示时长和计时器间隔
- 内置动画效果(从左到右展示)
- 灵活的桌面定位(居中、角落、系统托盘、自定义位置)
- 宿主窗体可见性管理
- 模态或非模态展示模式
- 支持透明度设置
- 完整的事件生命周期
Documentation and Navigation Guide
文档和导航指南
Getting Started
入门教程
📄 Read: references/getting-started.md
Start here for initial setup:
- Assembly references and NuGet packages
- Adding SplashControl through designer or code
- Basic property configuration
- AutoMode vs manual invocation
- Running your first splash screen
📄 阅读: references/getting-started.md
从这里开始完成初始配置:
- 程序集引用和NuGet包安装
- 通过设计器或代码添加SplashControl
- 基础属性配置
- 自动模式 vs 手动调用
- 运行你的第一个闪屏
Display and Timing Configuration
展示和时间配置
📄 Read: references/automode-timing.md
Configure when and how the splash screen appears:
- AutoMode for automatic display on form load
- AutoModeDisableOwner for modal splash screens
- ShowSplash() method for manual display control
- HideSplash() to close programmatically
- ShowDialogSplash() for modal dialog display
- TimerInterval to control display duration
- IsShowing property to check display state
📄 阅读: references/automode-timing.md
配置闪屏的展示时机和方式:
- 自动模式:窗体加载时自动展示闪屏
- AutoModeDisableOwner:实现模态闪屏
- ShowSplash() 方法手动控制展示
- HideSplash() 方法程序化关闭闪屏
- ShowDialogSplash() 展示模态对话框形式的闪屏
- TimerInterval 控制展示时长
- IsShowing 属性检查闪屏展示状态
Image and Animation Settings
图片和动画设置
📄 Read: references/image-animation.md
Customize the visual appearance:
- Setting the SplashImage property
- Enabling animation with ShowAnimation
- Configuring transparent colors
- ShowAsTopMost to control window layering
- Animation behavior and effects
📄 阅读: references/image-animation.md
自定义视觉效果:
- 设置SplashImage属性
- 开启ShowAnimation启用动画
- 配置透明色
- ShowAsTopMost控制窗口层级
- 动画行为和效果配置
Alignment and Positioning
对齐和定位
📄 Read: references/alignment-positioning.md
Control splash screen location on the desktop:
- DesktopAlignment options (Center, SystemTray, corners)
- Custom positioning strategies
- Visual examples for each alignment mode
📄 阅读: references/alignment-positioning.md
控制闪屏在桌面的展示位置:
- DesktopAlignment选项(居中、系统托盘、各个角落)
- 自定义定位策略
- 每种对齐模式的视觉示例
Host Form Management
宿主窗体管理
📄 Read: references/host-form-settings.md
Manage the parent form during splash display:
- HostForm property configuration
- HideHostForm to conceal the main form
- HostFormWindowState for controlling form state (Normal, Minimized, Maximized)
- Coordination between splash and host form
📄 阅读: references/host-form-settings.md
闪屏展示期间管理父窗体:
- HostForm属性配置
- HideHostForm隐藏主窗体
- HostFormWindowState控制窗体状态(普通、最小化、最大化)
- 闪屏和宿主窗体的协同
Custom SplashPanel Integration
自定义SplashPanel集成
📄 Read: references/splashpanel-integration.md
Create fully customized splash panels:
- Using SplashPanel instead of static images
- CustomSplashPanel property
- UseCustomSplashPanel to enable custom panels
- Designing panels with controls (labels, progress bars, etc.)
- SplashControlPanel property
- ShowInTaskbar and FormIcon configuration
- Complete integration workflow with code examples
📄 阅读: references/splashpanel-integration.md
创建完全自定义的闪屏面板:
- 使用SplashPanel替代静态图片
- CustomSplashPanel属性
- UseCustomSplashPanel启用自定义面板
- 设计带控件的面板(标签、进度条等)
- SplashControlPanel属性
- ShowInTaskbar和FormIcon配置
- 完整集成流程和代码示例
Event Handling
事件处理
📄 Read: references/events.md
Handle splash screen lifecycle events:
- BeforeSplash event (with cancellation support)
- SplashDisplayed event
- SplashClosing event
- SplashClosed event
- Event notification methods
- Logging and debugging patterns
📄 阅读: references/events.md
处理闪屏生命周期事件:
- BeforeSplash事件(支持取消)
- SplashDisplayed事件
- SplashClosing事件
- SplashClosed事件
- 事件通知方法
- 日志和调试模式
Quick Start
快速开始
Basic Image-Based Splash Screen
基础的基于图片的闪屏
csharp
using 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;
}
}csharp
using Syncfusion.Windows.Forms.Tools;
public partial class Form1 : Form
{
private SplashControl splashControl1;
public Form1()
{
InitializeComponent();
// 初始化SplashControl
this.splashControl1 = new SplashControl();
// 设置闪屏图片
this.splashControl1.SplashImage = Image.FromFile("splash.png");
// 配置基础属性
this.splashControl1.HostForm = this;
this.splashControl1.TimerInterval = 3000; // 展示3秒
this.splashControl1.AutoMode = true; // 窗体加载时自动展示
this.splashControl1.DesktopAlignment = SplashAlignment.Center;
// 可选:启用动画
this.splashControl1.ShowAnimation = true;
}
}Manual Display Control
手动控制展示
csharp
// 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);
}csharp
// 手动展示闪屏
private void ShowSplashButton_Click(object sender, EventArgs e)
{
// 展示闪屏并禁用宿主窗体
splashControl1.ShowSplash(true);
}
// 程序化隐藏闪屏
private void HideSplashButton_Click(object sender, EventArgs e)
{
splashControl1.HideSplash();
}
// 展示为模态对话框
private void ShowModalSplash_Click(object sender, EventArgs e)
{
splashControl1.ShowDialogSplash(this);
}Common Patterns
常用模式
Automatic Splash with Hidden Host Form
自动闪屏+隐藏宿主窗体
Display splash screen while hiding the main form during initialization:
csharp
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();
};
}初始化期间展示闪屏同时隐藏主窗体:
csharp
private void InitializeSplash()
{
splashControl1.HostForm = this;
splashControl1.SplashImage = Properties.Resources.CompanyLogo;
splashControl1.AutoMode = true;
splashControl1.HideHostForm = true;
splashControl1.TimerInterval = 4000;
splashControl1.DesktopAlignment = SplashAlignment.Center;
// 监听闪屏关闭事件执行初始化
splashControl1.SplashClosed += (s, e) =>
{
// 闪屏关闭后执行应用初始化
LoadApplicationData();
};
}Custom SplashPanel with Progress
带进度的自定义SplashPanel
Create a custom splash panel with controls:
csharp
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;
}创建带控件的自定义闪屏面板:
csharp
private void SetupCustomSplashPanel()
{
// 创建并设计SplashPanel
SplashPanel splashPanel = new SplashPanel();
splashPanel.BackgroundColor = new BrushInfo(GradientStyle.Vertical,
Color.White, Color.LightBlue);
splashPanel.Size = new Size(400, 200);
// 添加标签
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);
// 配置SplashControl使用自定义面板
splashControl1.CustomSplashPanel = splashPanel;
splashControl1.UseCustomSplashPanel = true;
splashControl1.HostForm = this;
splashControl1.TimerInterval = 5000;
}Event-Driven Splash Display
事件驱动的闪屏展示
Handle events for logging and control:
csharp
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();
};
}处理事件实现日志和控制:
csharp
private void ConfigureSplashEvents()
{
splashControl1.BeforeSplash += (s, e) =>
{
// 展示前记录日志
Debug.WriteLine("Splash screen about to display");
// 按需取消展示
// 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();
};
}Transparent Splash Screen
透明闪屏
Create a splash screen with transparent regions:
csharp
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;
}创建带透明区域的闪屏:
csharp
private void ConfigureTransparentSplash()
{
splashControl1.SplashImage = Properties.Resources.LogoWithTransparency;
splashControl1.TransparentColor = Color.White; // 白色像素设为透明
splashControl1.ShowAnimation = true;
splashControl1.ShowAsTopMost = true;
splashControl1.DesktopAlignment = SplashAlignment.Center;
splashControl1.TimerInterval = 3000;
}Key Properties
核心属性
| 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) |
| 属性 | 类型 | 描述 |
|---|---|---|
| AutoMode | bool | 窗体加载时自动展示闪屏 |
| SplashImage | Image | 作为闪屏展示的图片 |
| TimerInterval | int | 展示时长,单位为毫秒(默认:5000) |
| DesktopAlignment | SplashAlignment | 桌面位置(居中、系统托盘、角落、自定义) |
| HostForm | Form | SplashControl的父窗体 |
| HideHostForm | bool | 闪屏展示期间隐藏父窗体 |
| ShowAnimation | bool | 启用从左到右的动画效果 |
| CustomSplashPanel | SplashPanel | 替代图片展示的自定义面板 |
| UseCustomSplashPanel | bool | 使用CustomSplashPanel替代SplashImage |
| AutoModeDisableOwner | bool | 自动模式下模态展示闪屏 |
| ShowAsTopMost | bool | 将闪屏展示为顶层窗口 |
| TransparentColor | Color | 闪屏图片中要设为透明的颜色 |
| IsShowing | bool | 标识闪屏是否正在展示(只读) |
Key Methods
核心方法
| 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 |
| 方法 | 描述 |
|---|---|
| ShowSplash(bool disableOwner) | 手动展示闪屏 |
| HideSplash() | 程序化关闭闪屏 |
| ShowDialogSplash(Form owner) | 展示闪屏为模态对话框 |
| ShowDialogSplash(Point location, Form owner) | 在指定位置展示模态闪屏 |
Key Events
核心事件
| 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 |
| 事件 | 描述 |
|---|---|
| BeforeSplash | 闪屏展示前触发(可取消) |
| SplashDisplayed | 闪屏展示后触发 |
| SplashClosing | 闪屏关闭前触发(可取消) |
| SplashClosed | 闪屏关闭后触发 |
Common Use Cases
常见使用场景
Application Startup Branding
应用启动品牌展示
Display company logo and version information during application load, hiding the main form until initialization completes.
应用加载期间展示公司logo和版本信息,初始化完成前隐藏主窗体。
Long Initialization Process
长时间初始化流程
Show a custom splash panel with progress indicator while loading data, initializing components, or connecting to services.
加载数据、初始化组件或连接服务时,展示带进度指示器的自定义闪屏面板。
Version Update Notification
版本更新通知
Display splash screen with "What's New" information when the application starts after an update.
应用更新后启动时,展示带“新功能”信息的闪屏。
Professional User Experience
专业用户体验
Create animated, transparent splash screens that match your application's branding and design language.
创建符合应用品牌和设计语言的动画透明闪屏。
Timed Information Display
定时信息展示
Show important announcements, tips, or messages for a specific duration before allowing user interaction.
允许用户交互前,展示重要公告、提示或消息一段时间。
Related Components
相关组件
- SplashPanel: Standalone splash panel that can be used independently or integrated with SplashControl
- SplashScreen: Alternative splash screen implementation approaches in WinForms
- SplashPanel: 可独立使用或与SplashControl集成的独立闪屏面板
- SplashScreen: WinForms中其他闪屏实现方案
Tips and Best Practices
提示和最佳实践
- Keep splash duration reasonable: 2-5 seconds is ideal; longer durations frustrate users
- Match application theme: Ensure splash screen design aligns with your application's visual identity
- Use AutoMode for simplicity: Unless you need complex control, AutoMode handles most scenarios
- Handle SplashClosed event: Perform initialization tasks when splash closes to ensure smooth transition
- Consider SplashPanel for dynamic content: Use custom panels when you need progress bars or changing text
- Test different alignments: Center usually works best, but SystemTray can be less intrusive
- Use HideHostForm judiciously: Hiding the host form can create a cleaner startup experience
- Enable animation selectively: Animation adds polish but may not suit all application types
- 保持闪屏时长合理: 2-5秒是理想值,过长会让用户感到烦躁
- 匹配应用主题: 确保闪屏设计和应用的视觉风格统一
- 优先使用自动模式: 除非需要复杂控制,自动模式可满足大部分场景
- 处理SplashClosed事件: 闪屏关闭时执行初始化任务,保证过渡流畅
- 动态内容优先使用SplashPanel: 需要进度条或动态文字时使用自定义面板
- 测试不同对齐方式: 居中通常效果最好,系统托盘位置的侵入性更低
- 合理使用HideHostForm: 隐藏宿主窗体可以带来更清爽的启动体验
- 选择性启用动画: 动画可以提升质感,但并非适合所有类型的应用
Assembly Dependencies
程序集依赖
Required assemblies:
Syncfusion.Shared.Base.dllSyncfusion.Tools.Windows.dll
NuGet Package:
Install-Package Syncfusion.Tools.WindowsRefer to Syncfusion control dependencies documentation for complete dependency information.
必须的程序集:
Syncfusion.Shared.Base.dllSyncfusion.Tools.Windows.dll
NuGet包:
Install-Package Syncfusion.Tools.Windows参考Syncfusion控件依赖文档获取完整的依赖信息。