mcpField
S
syncfusion-winforms-splash-panel

syncfusion-winforms-splash-panel

github.com/syncfusion设计与 UI277 次安装1 周前更新
代码仓库

关于 syncfusion-winforms-splash-panel

syncfusion-winforms-splash-panel 是面向 Windows Forms 开发者的 Syncfusion SplashPanel 控件技能,可用于启动画面和通知窗口。它支持动画、定时关闭、子控件及灵活定位,也可通过模态或非模态方式显示。

主要功能

  1. 01滑动、淡入和 Marquee 动画
  2. 02支持桌面角落及自定义定位
  3. 03可定时关闭或手动控制
  4. 04可添加 Windows Forms 子控件
  5. 05提供显示与关闭生命周期事件

适用场景

  1. 01应用启动时展示品牌信息
  2. 02长时间操作期间显示进度
  3. 03显示自动关闭的通知弹窗
  4. 04创建模态信息或加载窗口

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/syncfusion/winforms-ui-components-skills --skill syncfusion-winforms-splash-panel

安装后在 Claude Code 中输入/syncfusion-winforms-splash-panel确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
animation-appearance.md
display-methods.md
events.md
getting-started.md
slide-transitions.md

详细介绍

Windows Forms 启动画面面板(SplashPanel)

Syncfusion Windows Forms SplashPanel 控件可创建自定义启动画面,在应用程序启动期间显示,也可用作低干扰通知窗口。它支持动画、子控件、定时自动关闭以及灵活定位。

何时使用此技能

在以下情况下使用此技能:

  • 在应用程序启动或加载期间显示启动画面
  • 在初始化期间显示进度信息或品牌标识
  • 创建通知弹窗,类似 MSN Messenger 或电子邮件通知
  • 使用自定义内容和动画实现加载指示器
  • 显示定时消息,在指定时长后自动关闭
  • 显示包含自定义启动画面内容的模态对话框
  • 为启动画面窗口添加动画过渡效果(滑动、淡入淡出、跑马灯)
  • 将启动画面窗口定位到桌面的特定位置(中心、角落、系统托盘区域、自定义位置)
  • 在启动画面中包含子控件(按钮、标签、图像)
  • 处理启动画面的生命周期事件(显示前、已显示、正在关闭、已关闭)

组件概述

主要功能:

  • **动画样式:**滑动(水平/垂直/定向)、淡入淡出、跑马灯
  • **桌面对齐方式:**中心、SystemTray、角落(LeftTop、LeftBottom、RightTop、RightBottom)、自定义
  • **显示方法:**ShowSplash(非模态)、ShowDialogSplash(模态)、HideSplash
  • **自动关闭计时器:**可配置时间间隔或手动控制(-1 表示不自动关闭)
  • **子控件:**可向启动画面面板添加任意 Windows Forms 控件
  • **外观:**渐变背景、图像、边框、透明度
  • **行为:**AllowMove、AllowResize、CloseOnClick 选项
  • **事件:**BeforeSplash、SplashDisplayed、SplashClosing、SplashClosed、鼠标事件

文档与导航指南

入门指南

📄 阅读:references/getting-started.md

在以下情况下阅读此参考文档:

  • 通过 NuGet 安装 SplashPanel,或在设计器中进行配置
  • 将 SplashPanel 添加到 Windows Forms 项目
  • 以编程方式创建 SplashPanel 实例
  • 向启动画面面板添加子控件
  • 调用 ShowSplash() 方法以进行基本显示
  • 了解程序集要求和部署方式
显示方法

📄 阅读:references/display-methods.md

在以下情况下阅读此参考文档:

  • 使用 ShowSplash() 方法及其参数显示启动画面面板
  • 使用 HideSplash() 方法隐藏启动画面面板
  • 使用 ShowDialogSplash() 将其显示为模态对话框
  • 使用 IsShowing() 检查启动画面当前是否正在显示
  • 配置 TimerInterval 以设置自动关闭时长
  • 设置启动画面位置和所有者窗体
  • 使用自定义图标/文本在任务栏中显示启动画面
动画与外观

📄 阅读:references/animation-appearance.md

在以下情况下阅读此参考文档:

  • 启用动画并配置动画速度
  • 设置 SlideStyle(Horizontal、Vertical、FadeIn 等)
  • 将启动画面显示为最顶层窗口
  • 使用渐变或图像自定义背景
  • 配置边框样式和透明度
  • 设置桌面对齐方式(中心、SystemTray、角落)
  • 启用行为选项(AllowMove、AllowResize、CloseOnClick)
  • 当鼠标悬停在启动画面上时暂停自动关闭
滑动过渡

📄 阅读:references/slide-transitions.md

在以下情况下阅读此参考文档:

  • 配置 AnimationDirection(Default、LeftToRight、RightToLeft)
  • 实现横跨屏幕的跑马灯过渡效果
  • 设置 MarqueeDirection(LeftToRight、RightToLeft、TopToBottom、BottomToTop)
  • 将滑动过渡与桌面对齐方式结合使用
  • 创建高级动画效果
事件

📄 阅读: references/events.md

在以下情况下阅读此参考文档:

  • 处理 BeforeSplash 事件(取消显示启动画面)
  • 响应 SplashDisplayed 事件
  • 处理 SplashClosing 事件(取消关闭)
  • 响应 SplashClosed 事件(获取关闭类型)
  • 处理启动画面上的鼠标进入/离开事件
  • 在启动画面生命周期中实现自定义逻辑

快速入门

基本启动画面
using Syncfusion.Windows.Forms.Tools;

// Create splash panel
SplashPanel splashPanel = new SplashPanel();
splashPanel.Size = new Size(400, 300);
splashPanel.DesktopAlignment = SplashAlignment.Center;
splashPanel.TimerInterval = 3000; // Show for 3 seconds
splashPanel.ShowAnimation = true;
splashPanel.SlideStyle = SlideStyle.FadeIn;

// Add to form
this.Controls.Add(splashPanel);

// Show splash
splashPanel.ShowSplash();

VB.NET:

Imports Syncfusion.Windows.Forms.Tools

' Create splash panel
Dim splashPanel As New SplashPanel()
splashPanel.Size = New Size(400, 300)
splashPanel.DesktopAlignment = SplashAlignment.Center
splashPanel.TimerInterval = 3000 ' Show for 3 seconds
splashPanel.ShowAnimation = True
splashPanel.SlideStyle = SlideStyle.FadeIn

' Add to form
Me.Controls.Add(splashPanel)

' Show splash
splashPanel.ShowSplash()

常见模式

模式 1:带品牌标识的启动画面
// Application startup splash
SplashPanel startupSplash = new SplashPanel();
startupSplash.Size = new Size(500, 350);
startupSplash.BackgroundImage = Image.FromFile("splash_image.png");
startupSplash.DesktopAlignment = SplashAlignment.Center;
startupSplash.TimerInterval = 5000;
startupSplash.ShowAnimation = true;
startupSplash.AnimationSpeed = 20;

// Add label with version info
Label versionLabel = new Label();
versionLabel.Text = "Version 2.0";
versionLabel.Location = new Point(20, 300);
versionLabel.AutoSize = true;
startupSplash.Controls.Add(versionLabel);

this.Controls.Add(startupSplash);
startupSplash.ShowSplash();
模式 2:通知样式弹出窗口
// Non-obtrusive notification (like MSN Messenger)
SplashPanel notificationPanel = new SplashPanel();
notificationPanel.Size = new Size(300, 100);
notificationPanel.DesktopAlignment = SplashAlignment.RightBottom;
notificationPanel.SlideStyle = SlideStyle.BottomToTop;
notificationPanel.AnimationDirection = AnimationDirection.Default;
notificationPanel.TimerInterval = 5000;
notificationPanel.ShowAnimation = true;
notificationPanel.CloseOnClick = true;
notificationPanel.SuspendAutoCloseWhenMouseOver = true;

// Add notification content
Label messageLabel = new Label();
messageLabel.Text = "New message received!";
messageLabel.Location = new Point(10, 40);
notificationPanel.Controls.Add(messageLabel);

this.Controls.Add(notificationPanel);
notificationPanel.ShowSplash();
模式 3:模态加载对话框
// Modal splash dialog that blocks interaction
SplashPanel modalSplash = new SplashPanel();
modalSplash.Size = new Size(400, 200);
modalSplash.TimerInterval = -1; // No auto-close
modalSplash.DesktopAlignment = SplashAlignment.Center;

// Add progress indicator
Label loadingLabel = new Label();
loadingLabel.Text = "Loading, please wait...";
loadingLabel.Location = new Point(120, 90);
loadingLabel.AutoSize = true;
modalSplash.Controls.Add(loadingLabel);

this.Controls.Add(modalSplash);

// Show as modal dialog (blocks until closed)
modalSplash.ShowDialogSplash(this);
模式 4:带渐变效果的动画启动画面
// Splash with gradient background and animation
SplashPanel animatedSplash = new SplashPanel();
animatedSplash.Size = new Size(450, 300);
animatedSplash.BackgroundColor = new BrushInfo(
    GradientStyle.Vertical, 
    Color.DarkBlue, 
    Color.LightBlue);
animatedSplash.DesktopAlignment = SplashAlignment.Center;
animatedSplash.SlideStyle = SlideStyle.Horizontal;
animatedSplash.ShowAnimation = true;
animatedSplash.AnimationSpeed = 30;
animatedSplash.TimerInterval = 4000;
animatedSplash.ShowAsTopMost = true;

this.Controls.Add(animatedSplash);
animatedSplash.ShowSplash();
模式 5:自定义位置的启动画面
// Splash at custom screen location
SplashPanel customSplash = new SplashPanel();
customSplash.Size = new Size(350, 250);
customSplash.DesktopAlignment = SplashAlignment.Custom;
customSplash.TimerInterval = 3000;

// Show at mouse position
Point mousePos = Control.MousePosition;
customSplash.ShowSplash(mousePos, this, false);
模式 6:带生命周期事件的启动画面
// Splash with event handlers
SplashPanel eventSplash = new SplashPanel();
eventSplash.Size = new Size(400, 250);
eventSplash.DesktopAlignment = SplashAlignment.Center;
eventSplash.TimerInterval = 5000;

// Subscribe to events
eventSplash.BeforeSplash += (s, e) => {
    Console.WriteLine("About to show splash");
};

eventSplash.SplashDisplayed += (s, e) => {
    Console.WriteLine("Splash is now visible");
};

eventSplash.SplashClosing += (s, e) => {
    Console.WriteLine("Splash is closing");
    // e.Cancel = true; // Uncomment to prevent closing
};

eventSplash.SplashClosed += (s, e) => {
    Console.WriteLine($"Splash closed: {e.SplashCloseType}");
};

this.Controls.Add(eventSplash);
eventSplash.ShowSplash();

关键属性

属性类型描述
TimerIntervalint启动画面的显示时长,单位为毫秒(-1 表示不自动关闭)
DesktopAlignmentSplashAlignment在桌面上的位置(Center、SystemTray、角落、Custom)
SlideStyleSlideStyle动画样式(Horizontal、Vertical、FadeIn 等)
AnimationSpeedint动画过渡速度(值越大,速度越快)
ShowAnimationbool启用/禁用显示动画
ShowAsTopMostbool将启动画面显示为最顶层窗口
BackgroundColorBrushInfo渐变或纯色背景
BackgroundImageImage启动画面的背景图像
AllowMovebool允许运行时移动启动画面
AllowResizebool允许运行时调整启动画面的大小
CloseOnClickbool用户点击启动画面时将其关闭
SuspendAutoCloseWhenMouseOverbool鼠标悬停在启动画面上时暂停自动关闭计时器
AnimationDirectionAnimationDirection滑动动画的方向
MarqueeDirectionMarqueeDirection跑马灯过渡的方向
BorderStyleBorder3DStyle启动画面的 3D 边框样式
TransparentColorColor背景的透明色
ShowInTaskbarbool在 Windows 任务栏中显示启动画面
SlideStyleSlideStyle动画样式。可选值包括:Slide(基本滑动过渡)、Horizontal、Vertical、FadeIn 和 Marquee(连续跑马灯过渡)。

关键方法

方法描述
ShowSplash()显示启动面板
ShowSplash(Point, Form, bool)在指定位置显示,并指定所有者窗体
ShowDialogSplash(Form)以模态对话框形式显示
ShowDialogSplash(Point, Form)在指定位置以模态对话框形式显示
HideSplash()隐藏启动面板
IsShowing()检查启动画面当前是否正在显示
SuspendAutoCloseMode()暂停自动关闭计时器
RestoreAutoCloseMode()恢复自动关闭计时器

关键事件

事件EventArgs 类型描述
BeforeSplashCancelEventArgs在显示启动画面前触发;可以取消。
SplashDisplayedEventArgs启动画面变为可见后触发。
SplashClosingCancelEventArgs在启动画面关闭前触发;可以取消。
SplashClosedSplashClosedEventArgs启动画面关闭后触发;提供关闭类型。
SplashMouseEnterEventArgs鼠标进入启动面板时触发。
SplashMouseLeaveEventArgs鼠标离开启动面板时触发。

常见用例

用例 1:应用程序启动画面

在应用程序初始化期间显示品牌标识和版本信息。

用例 2:加载指示器

在耗时操作期间显示带进度信息的启动面板。

用例 3:通知弹出窗口

显示不打扰用户的消息(新邮件、更新),并在超时或点击时自动关闭。

用例 4:关于/信息对话框

以模态启动画面显示应用程序信息。

用例 5:自定义消息窗口

创建带有自定义控件和动画的主题化消息窗口。

最佳实践

  1. 设置合适的 TimerInterval:启动画面使用 2000-5000ms,通知使用 3000-8000ms
  2. 启用 ShowAsTopMost:确保启动期间启动画面显示在其他窗口上方
  3. 对通知使用 CloseOnClick:允许用户关闭通知样式的弹出窗口
  4. 处理 BeforeSplash 事件:根据条件初始化数据或取消显示
  5. 选择合适的动画:微妙效果使用 FadeIn,动态效果使用 Slide,吸引注意力使用 Marquee
  6. 谨慎添加子控件:确保控件在启动画面边界内可见且位置正确
  7. 测试不同的对齐方式:确认启动画面在不同屏幕分辨率下均能正确显示
  8. 正确释放资源:确保窗体关闭时正确释放启动面板

评论

支持 Markdown