syncfusion-winforms-statusbaradv-panel
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImplementing Status Bar Panels (StatusBarAdvPanel)
实现状态栏面板(StatusBarAdvPanel)
This skill guides the implementation of the Syncfusion StatusBarAdvPanel control in Windows Forms applications. StatusBarAdvPanel is a panel-derived class that displays status bar information with enhanced appearance, marquee animation, and can be used both within StatusBarAdv controls and standalone on forms.
本指南介绍如何在Windows Forms应用中实现Syncfusion StatusBarAdvPanel控件。StatusBarAdvPanel是派生自面板的类,用于展示状态栏信息,支持增强外观、跑马灯动画,既可以嵌入StatusBarAdv控件中使用,也可以在窗体上独立使用。
When to Use This Skill
何时使用本指南
Use this skill when you need to:
- Create individual status bar panels with custom content and styling
- Display key state indicators (NumLock, CapsLock, ScrollLock, Insert key)
- Show date/time information in various formats (short date, long date, short time, long time)
- Display culture information (CurrentCulture) in status bars
- Implement marquee text animation with scrolling, sliding, or alternating effects
- Apply gradient backgrounds or patterns to status bar panels
- Configure panel alignment within StatusBarAdv or flow layouts
- Add custom borders (2D or 3D) to individual panels
- Handle property change events for dynamic panel updates
- Create themed status bar panels matching application design
当你需要实现以下需求时可参考本指南:
- 创建带有自定义内容和样式的独立状态栏面板
- 展示按键状态指示器(NumLock、CapsLock、ScrollLock、Insert键)
- 以多种格式展示日期/时间信息(短日期、长日期、短时间、长时间)
- 在状态栏中展示文化信息(CurrentCulture)
- 实现带有滚动、滑动或交替效果的跑马灯文本动画
- 为状态栏面板应用渐变背景或图案
- 在StatusBarAdv或流式布局中配置面板对齐方式
- 为独立面板添加自定义边框(2D或3D)
- 处理属性变更事件实现面板动态更新
- 创建匹配应用设计的主题化状态栏面板
Component Overview
组件概述
StatusBarAdvPanel is a versatile panel control designed for status bars with:
- Panel Types: Predefined types for key states, date/time, culture, or custom text
- Marquee Animation: Scrolling text with customizable speed, direction, and style
- Enhanced Backgrounds: Gradient, pattern, and solid color options using BrushInfo
- Icon Support: Display icons alongside panel text
- Alignment Options: Content alignment (Left, Right, Center) and flow alignment (including Justify)
- Border Customization: 2D and 3D border styles with custom colors
- Auto-Sizing: Automatic resizing based on content (SizeToContent)
- Theme Support: ThemesEnabled and IgnoreThemeBackground properties
- ToolTip Support: Add tooltips to provide additional information
- 18 Property Events: Comprehensive event handling for property changes
Assembly: Syncfusion.Tools.Windows
Dependencies: Syncfusion.Shared.Base, Syncfusion.Tools.Windows
Namespace:
Dependencies: Syncfusion.Shared.Base, Syncfusion.Tools.Windows
Namespace:
Syncfusion.Windows.Forms.ToolsStatusBarAdvPanel是专为状态栏设计的多功能面板控件,具备以下特性:
- 面板类型:预定义了按键状态、日期/时间、文化、自定义文本等类型
- 跑马灯动画:可自定义速度、方向和样式的滚动文本效果
- 增强背景:支持通过BrushInfo实现渐变、图案和纯色背景选项
- 图标支持:可在面板文本旁展示图标
- 对齐选项:内容对齐(左、右、居中)和流式对齐(包括两端对齐)
- 边框自定义:支持2D和3D边框样式,可自定义颜色
- 自动 sizing:可根据内容自动调整尺寸(SizeToContent)
- 主题支持:提供ThemesEnabled和IgnoreThemeBackground属性
- 工具提示支持:可添加工具提示提供额外信息
- 18个属性事件:提供全面的属性变更事件处理能力
程序集: Syncfusion.Tools.Windows
依赖项: Syncfusion.Shared.Base, Syncfusion.Tools.Windows
命名空间:
依赖项: Syncfusion.Shared.Base, Syncfusion.Tools.Windows
命名空间:
Syncfusion.Windows.Forms.ToolsDocumentation and Navigation Guide
文档与导航指南
Getting Started
入门指南
📄 Read: references/getting-started.md
When to read: First time implementing StatusBarAdvPanel, setting up assemblies, or creating basic panels.
- Assembly requirements and installation
- Designer-based setup with drag-and-drop
- Programmatic creation and initialization
- Adding panels to StatusBarAdv or forms
- Basic configuration (Location, Size, BackgroundColor)
- PanelType and BorderColor setup
- Troubleshooting common setup issues
📄 阅读: references/getting-started.md
适用场景: 首次实现StatusBarAdvPanel、配置程序集或创建基础面板时阅读。
- 程序集要求与安装
- 基于设计器的拖放式配置
- 编程式创建与初始化
- 将面板添加到StatusBarAdv或窗体中
- 基础配置(位置、尺寸、背景色)
- PanelType与BorderColor配置
- 常见配置问题排查
Panel Types and Behavior
面板类型与行为
📄 Read: references/panel-types-and-behavior.md
When to read: Configuring panel types, displaying key states or date/time, or customizing panel sizing.
- PanelType property options (key states, date/time, culture, custom)
- Key state indicators (NumLock, CapsLock, ScrollLock, InsertKey)
- Date/time formats (ShortDate, LongDate, ShortTime, LongTime)
- Custom text panels with Text property
- GetText() method for key state text retrieval
- SizeToContent for automatic panel resizing
- PreferredSize property configuration
📄 阅读: references/panel-types-and-behavior.md
适用场景: 配置面板类型、展示按键状态或日期/时间、自定义面板尺寸时阅读。
- PanelType属性选项(按键状态、日期/时间、文化、自定义)
- 按键状态指示器(NumLock、CapsLock、ScrollLock、InsertKey)
- 日期/时间格式(ShortDate、LongDate、ShortTime、LongTime)
- 通过Text属性实现自定义文本面板
- 用于获取按键状态文本的GetText()方法
- 支持自动调整面板尺寸的SizeToContent属性
- PreferredSize属性配置
Appearance and Styling
外观与样式
📄 Read: references/appearance-styling.md
When to read: Customizing panel appearance, applying gradients, setting background colors, or adding icons.
- BackgroundColor property with BrushInfo
- Gradient styles (6 types: ForwardDiagonal, BackwardDiagonal, Horizontal, Vertical, PathRectangle, PathEllipse)
- Pattern styles (Cross, DiagonalCross, DottedGrid, LargeGrid, Wave)
- GradientBackground and GradientColors configuration
- BackColor and ForeColor customization
- Icon property for panel icons
- Complete styling examples
📄 阅读: references/appearance-styling.md
适用场景: 自定义面板外观、应用渐变效果、设置背景色或添加图标时阅读。
- 搭配BrushInfo使用的BackgroundColor属性
- 渐变样式(6种:ForwardDiagonal、BackwardDiagonal、Horizontal、Vertical、PathRectangle、PathEllipse)
- 图案样式(Cross、DiagonalCross、DottedGrid、LargeGrid、Wave)
- GradientBackground与GradientColors配置
- BackColor与ForeColor自定义
- 用于设置面板图标的Icon属性
- 完整样式示例
Text and Marquee Animation
文本与跑马灯动画
📄 Read: references/text-and-marquee.md
When to read: Implementing marquee text animation, configuring scrolling effects, or controlling animation behavior.
- Text property configuration
- IsMarquee property for enabling animation
- AnimationDelay for timing control
- AnimationDirection (Left/Right)
- AnimationSpeed customization
- AnimationStyle (Scroll, Slide, Alternate)
- StartAnimation() and StopAnimation() methods
- Complete marquee examples
📄 阅读: references/text-and-marquee.md
适用场景: 实现跑马灯文本动画、配置滚动效果或控制动画行为时阅读。
- Text属性配置
- 用于启用动画的IsMarquee属性
- 控制时序的AnimationDelay属性
- 动画方向(左/右)AnimationDirection属性
- AnimationSpeed自定义
- 动画样式(滚动、滑动、交替)AnimationStyle属性
- StartAnimation()和StopAnimation()方法
- 完整跑马灯效果示例
Alignment and Borders
对齐与边框
📄 Read: references/alignment-and-borders.md
When to read: Configuring panel alignment, customizing borders, or setting up flow layout positioning.
- Alignment property (Left, Right, Center)
- HAlign property for flow layout (Left, Right, Center, Justify)
- BorderStyle property (None, FixedSingle, Fixed3D)
- Border3DStyle options (10 styles)
- BorderColor for 2D borders
- BorderSingle styles (Solid, Dashed, Dotted, Inset, Outset, None)
- BorderSides configuration (Left, Top, Right, Bottom, Middle, All)
- 2D vs 3D border examples
📄 阅读: references/alignment-and-borders.md
适用场景: 配置面板对齐、自定义边框或设置流式布局定位时阅读。
- Alignment属性(左、右、居中)
- 用于流式布局的HAlign属性(左、右、居中、两端对齐)
- BorderStyle属性(无、单实线、3D固定边框)
- Border3DStyle选项(10种样式)
- 用于2D边框的BorderColor属性
- BorderSingle样式(实线、虚线、点线、内凹、外凸、无)
- BorderSides配置(左、上、右、下、中间、全部)
- 2D与3D边框示例
Themes, ToolTips, and Events
主题、工具提示与事件
📄 Read: references/themes-tooltips-events.md
When to read: Implementing themes, adding tooltips, or handling property change events.
- ThemesEnabled property
- IgnoreThemeBackground property
- ToolTip property configuration
- 18 property change events
- Event subscription examples
- Event handling patterns
- Complete event monitoring example
📄 阅读: references/themes-tooltips-events.md
适用场景: 实现主题、添加工具提示或处理属性变更事件时阅读。
- ThemesEnabled属性
- IgnoreThemeBackground属性
- ToolTip属性配置
- 18个属性变更事件
- 事件订阅示例
- 事件处理模式
- 完整事件监控示例
Quick Start Example
快速入门示例
Basic StatusBarAdvPanel with Gradient Background
带有渐变背景的基础StatusBarAdvPanel
C#:
csharp
using Syncfusion.Windows.Forms.Tools;
using Syncfusion.Drawing;
using System.Drawing;
using System.Windows.Forms;
public partial class MainForm : Form
{
private StatusBarAdvPanel statusBarAdvPanel1;
public MainForm()
{
InitializeComponent();
SetupStatusBarPanel();
}
private void SetupStatusBarPanel()
{
// Create StatusBarAdvPanel
statusBarAdvPanel1 = new StatusBarAdvPanel
{
// Set panel location and size
Location = new Point(160, 184),
Size = new Size(216, 48),
// Configure panel type to show long date
PanelType = StatusBarAdvPanelType.LongDate,
// Apply gradient background
BackgroundColor = new BrushInfo(
GradientStyle.BackwardDiagonal,
Color.PaleVioletRed,
Color.PeachPuff
),
// Set border and alignment
BorderColor = Color.Black,
HAlign = HorzFlowAlign.Left
};
// Add to form
this.Controls.Add(statusBarAdvPanel1);
}
}VB.NET:
vb
Imports Syncfusion.Windows.Forms.Tools
Imports Syncfusion.Drawing
Imports System.Drawing
Imports System.Windows.Forms
Public Partial Class MainForm
Inherits Form
Private statusBarAdvPanel1 As StatusBarAdvPanel
Public Sub New()
InitializeComponent()
SetupStatusBarPanel()
End Sub
Private Sub SetupStatusBarPanel()
' Create StatusBarAdvPanel
statusBarAdvPanel1 = New StatusBarAdvPanel With {
.Location = New Point(160, 184),
.Size = New Size(216, 48),
.PanelType = StatusBarAdvPanelType.LongDate,
.BackgroundColor = New BrushInfo(
GradientStyle.BackwardDiagonal,
Color.PaleVioletRed,
Color.PeachPuff
),
.BorderColor = Color.Black,
.HAlign = HorzFlowAlign.Left
}
' Add to form
Me.Controls.Add(statusBarAdvPanel1)
End Sub
End ClassC#:
csharp
using Syncfusion.Windows.Forms.Tools;
using Syncfusion.Drawing;
using System.Drawing;
using System.Windows.Forms;
public partial class MainForm : Form
{
private StatusBarAdvPanel statusBarAdvPanel1;
public MainForm()
{
InitializeComponent();
SetupStatusBarPanel();
}
private void SetupStatusBarPanel()
{
// 创建StatusBarAdvPanel
statusBarAdvPanel1 = new StatusBarAdvPanel
{
// 设置面板位置与尺寸
Location = new Point(160, 184),
Size = new Size(216, 48),
// 配置面板类型为展示长日期
PanelType = StatusBarAdvPanelType.LongDate,
// 应用渐变背景
BackgroundColor = new BrushInfo(
GradientStyle.BackwardDiagonal,
Color.PaleVioletRed,
Color.PeachPuff
),
// 设置边框与对齐方式
BorderColor = Color.Black,
HAlign = HorzFlowAlign.Left
};
// 添加到窗体
this.Controls.Add(statusBarAdvPanel1);
}
}VB.NET:
vb
Imports Syncfusion.Windows.Forms.Tools
Imports Syncfusion.Drawing
Imports System.Drawing
Imports System.Windows.Forms
Public Partial Class MainForm
Inherits Form
Private statusBarAdvPanel1 As StatusBarAdvPanel
Public Sub New()
InitializeComponent()
SetupStatusBarPanel()
End Sub
Private Sub SetupStatusBarPanel()
' 创建StatusBarAdvPanel
statusBarAdvPanel1 = New StatusBarAdvPanel With {
.Location = New Point(160, 184),
.Size = New Size(216, 48),
.PanelType = StatusBarAdvPanelType.LongDate,
.BackgroundColor = New BrushInfo(
GradientStyle.BackwardDiagonal,
Color.PaleVioletRed,
Color.PeachPuff
),
.BorderColor = Color.Black,
.HAlign = HorzFlowAlign.Left
}
' 添加到窗体
Me.Controls.Add(statusBarAdvPanel1)
End Sub
End ClassCommon Patterns
常见使用模式
Pattern 1: Marquee Panel with Scrolling Text
模式1:带滚动文本的跑马灯面板
Create an animated status panel with marquee scrolling text:
csharp
// Configure marquee panel
var marqueePanel = new StatusBarAdvPanel
{
Text = "Welcome to our application! Latest updates available...",
IsMarquee = true,
AnimationStyle = MarqueeStyle.Scroll,
AnimationDirection = MarqueeDirection.Left,
AnimationSpeed = 5,
AnimationDelay = 10,
Size = new Size(300, 30),
BackColor = Color.LightBlue
};
// Start animation on form load
marqueePanel.StartAnimation();
// Stop animation when needed
// marqueePanel.StopAnimation();创建带有跑马灯滚动文本的动画状态面板:
csharp
// 配置跑马灯面板
var marqueePanel = new StatusBarAdvPanel
{
Text = "Welcome to our application! Latest updates available...",
IsMarquee = true,
AnimationStyle = MarqueeStyle.Scroll,
AnimationDirection = MarqueeDirection.Left,
AnimationSpeed = 5,
AnimationDelay = 10,
Size = new Size(300, 30),
BackColor = Color.LightBlue
};
// 窗体加载时启动动画
marqueePanel.StartAnimation();
// 需要时停止动画
// marqueePanel.StopAnimation();Pattern 2: Key State Indicator Panels
模式2:按键状态指示器面板
Create panels displaying keyboard key states:
csharp
// NumLock indicator
var numLockPanel = new StatusBarAdvPanel
{
PanelType = StatusBarAdvPanelType.NumLockState,
Size = new Size(80, 24),
HAlign = HorzFlowAlign.Right,
BackgroundColor = new BrushInfo(Color.WhiteSmoke)
};
// CapsLock indicator
var capsLockPanel = new StatusBarAdvPanel
{
PanelType = StatusBarAdvPanelType.CapsLockState,
Size = new Size(80, 24),
HAlign = HorzFlowAlign.Right,
BackgroundColor = new BrushInfo(Color.WhiteSmoke)
};
// InsertKey indicator
var insertKeyPanel = new StatusBarAdvPanel
{
PanelType = StatusBarAdvPanelType.InsertKeyState,
Size = new Size(80, 24),
HAlign = HorzFlowAlign.Right,
BackgroundColor = new BrushInfo(Color.WhiteSmoke)
};创建展示键盘按键状态的面板:
csharp
// NumLock指示器
var numLockPanel = new StatusBarAdvPanel
{
PanelType = StatusBarAdvPanelType.NumLockState,
Size = new Size(80, 24),
HAlign = HorzFlowAlign.Right,
BackgroundColor = new BrushInfo(Color.WhiteSmoke)
};
// CapsLock指示器
var capsLockPanel = new StatusBarAdvPanel
{
PanelType = StatusBarAdvPanelType.CapsLockState,
Size = new Size(80, 24),
HAlign = HorzFlowAlign.Right,
BackgroundColor = new BrushInfo(Color.WhiteSmoke)
};
// InsertKey指示器
var insertKeyPanel = new StatusBarAdvPanel
{
PanelType = StatusBarAdvPanelType.InsertKeyState,
Size = new Size(80, 24),
HAlign = HorzFlowAlign.Right,
BackgroundColor = new BrushInfo(Color.WhiteSmoke)
};Pattern 3: Custom Border with 3D Effect
模式3:带3D效果的自定义边框
Apply custom 3D border to a panel:
csharp
// Create panel with 3D raised border
var borderedPanel = new StatusBarAdvPanel
{
Text = "Status: Ready",
Size = new Size(150, 30),
BorderStyle = BorderStyle.Fixed3D,
Border3DStyle = Border3DStyle.RaisedInner,
BorderSides = Border3DSide.All,
Alignment = HorizontalAlignment.Center,
BackgroundColor = new BrushInfo(
GradientStyle.Horizontal,
Color.LavenderBlush,
Color.RosyBrown
)
};为面板应用自定义3D边框:
csharp
// 创建带有3D凸起边框的面板
var borderedPanel = new StatusBarAdvPanel
{
Text = "Status: Ready",
Size = new Size(150, 30),
BorderStyle = BorderStyle.Fixed3D,
Border3DStyle = Border3DStyle.RaisedInner,
BorderSides = Border3DSide.All,
Alignment = HorizontalAlignment.Center,
BackgroundColor = new BrushInfo(
GradientStyle.Horizontal,
Color.LavenderBlush,
Color.RosyBrown
)
};Key Properties
核心属性
StatusBarAdvPanel Properties
StatusBarAdvPanel属性
| Property | Type | Description |
|---|---|---|
| PanelType | StatusBarAdvPanelType | Type of panel (Custom, NumLockState, CapsLockState, ScrollLockState, InsertKeyState, ShortDate, LongDate, ShortTime, LongTime, CurrentCulture) |
| Text | string | Text displayed in the panel (for Custom panel type) |
| BackgroundColor | BrushInfo | Background gradient, pattern, or solid color |
| Icon | Icon | Icon displayed in the panel |
| Alignment | HorizontalAlignment | Alignment of text and icon (Left, Right, Center) |
| HAlign | HorzFlowAlign | Horizontal alignment in flow layout (Left, Right, Center, Justify) |
| IsMarquee | bool | Enables marquee-style text animation |
| AnimationStyle | MarqueeStyle | Animation style (Scroll, Slide, Alternate) |
| AnimationDirection | MarqueeDirection | Animation direction (Left, Right) |
| AnimationSpeed | int | Speed of marquee animation |
| AnimationDelay | int | Delay before animation starts |
| BorderStyle | BorderStyle | Border style (None, FixedSingle, Fixed3D) |
| Border3DStyle | Border3DStyle | 3D border style (10 options) |
| BorderColor | Color | Color of 2D border |
| BorderSingle | ButtonBorderStyle | 2D border style (Solid, Dashed, Dotted, etc.) |
| BorderSides | Border3DSide | Border sides to display (All, Top, Bottom, Left, Right, Middle) |
| SizeToContent | bool | Auto-resize panel based on content |
| PreferredSize | Size | Preferred size in flow layout |
| ThemesEnabled | bool | Enables themed appearance |
| IgnoreThemeBackground | bool | Ignores theme background color |
| ToolTip | string | Tooltip text for the panel |
| 属性 | 类型 | 描述 |
|---|---|---|
| PanelType | StatusBarAdvPanelType | 面板类型(自定义、NumLock状态、CapsLock状态、ScrollLock状态、InsertKey状态、短日期、长日期、短时间、长时间、当前文化) |
| Text | string | 面板中展示的文本(适用于自定义面板类型) |
| BackgroundColor | BrushInfo | 背景渐变、图案或纯色 |
| Icon | Icon | 面板中展示的图标 |
| Alignment | HorizontalAlignment | 文本与图标的对齐方式(左、右、居中) |
| HAlign | HorzFlowAlign | 流式布局下的水平对齐方式(左、右、居中、两端对齐) |
| IsMarquee | bool | 启用跑马灯样式文本动画 |
| AnimationStyle | MarqueeStyle | 动画样式(滚动、滑动、交替) |
| AnimationDirection | MarqueeDirection | 动画方向(左、右) |
| AnimationSpeed | int | 跑马灯动画速度 |
| AnimationDelay | int | 动画启动前的延迟 |
| BorderStyle | BorderStyle | 边框样式(无、单实线、3D固定边框) |
| Border3DStyle | Border3DStyle | 3D边框样式(10种选项) |
| BorderColor | Color | 2D边框颜色 |
| BorderSingle | ButtonBorderStyle | 2D边框样式(实线、虚线、点线等) |
| BorderSides | Border3DSide | 要展示的边框边(全部、上、下、左、右、中间) |
| SizeToContent | bool | 根据内容自动调整面板尺寸 |
| PreferredSize | Size | 流式布局下的首选尺寸 |
| ThemesEnabled | bool | 启用主题化外观 |
| IgnoreThemeBackground | bool | 忽略主题背景色 |
| ToolTip | string | 面板的工具提示文本 |
Common Use Cases
常见使用场景
- Application Status Display: Show current application state with custom text and styling
- Keyboard State Indicators: Display NumLock, CapsLock, ScrollLock, and Insert key states
- Date/Time Information: Show current date and time in various formats
- Culture Information: Display current culture settings
- Marquee Announcements: Scrolling text for announcements or updates
- Progress Indicators: Custom panels with text indicating processing status
- Document Information: Show document-related information (line number, position, etc.)
- Themed Status Panels: Match application theme with coordinated panel styling
- 应用状态展示:通过自定义文本和样式展示应用当前状态
- 键盘状态指示器:展示NumLock、CapsLock、ScrollLock和Insert键状态
- 日期/时间信息:以多种格式展示当前日期和时间
- 文化信息:展示当前文化设置
- 跑马灯公告:滚动展示公告或更新信息
- 进度指示器:通过自定义面板文本展示处理状态
- 文档信息:展示文档相关信息(行号、位置等)
- 主题化状态面板:通过协调的面板样式匹配应用主题
Additional Resources
额外资源
For more information about StatusBarAdvPanel:
- Use within StatusBarAdv control for enhanced status bars
- Combine multiple panels with different types for comprehensive status displays
- Leverage events for dynamic panel updates based on application state
- Apply consistent theming across all panels for professional appearance
Related Skills:
- Implementing Status Bars (StatusBarAdv) - Parent control for hosting panels
了解更多StatusBarAdvPanel相关信息:
- 可在StatusBarAdv控件中使用以实现增强状态栏
- 组合多个不同类型的面板实现全面的状态展示
- 利用事件基于应用状态动态更新面板
- 为所有面板应用一致的主题实现专业外观
相关技能:
- 实现状态栏(StatusBarAdv) - 用于承载面板的父控件