syncfusion-winforms-status-bar
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseImplementing Status Bars (StatusBarAdv)
实现状态栏(StatusBarAdv)
This skill guides the implementation of the Syncfusion StatusBarAdv control in Windows Forms applications. StatusBarAdv is an advanced status bar that displays panels with enhanced backgrounds, appearances, and supports Office2016 themes.
本指南介绍如何在Windows Forms应用中实现Syncfusion StatusBarAdv控件。StatusBarAdv是一款高级状态栏控件,支持展示带有增强背景、自定义外观的面板,并且兼容Office2016主题。
When to Use This Skill
何时使用本指南
Use this skill when you need to:
- Display application status information at the bottom of forms
- Implement enhanced status bars with gradient backgrounds and styled panels
- Show date/time, culture information, or key states in status panels
- Create professional-looking status bars with Office2016 or Metro themes
- Add custom controls or panels to status bars
- Configure panel alignment and spacing in status displays
- Apply advanced border and background styling to status bars
- Handle status bar property change events
当你需要完成以下操作时可使用本指南:
- 在窗体底部展示应用状态信息
- 实现带有渐变背景和样式化面板的增强型状态栏
- 在状态面板中展示日期/时间、区域文化信息或按键状态
- 创建适配Office2016或Metro主题的专业外观状态栏
- 向状态栏添加自定义控件或面板
- 配置状态展示面板的对齐方式和间距
- 为状态栏应用高级边框和背景样式
- 处理状态栏属性变更事件
Component Overview
组件概述
StatusBarAdv is an advanced status bar control that extends the standard Windows Forms StatusBar with:
- StatusBarAdvPanel Collection: Add multiple panels with custom content and styling
- Enhanced Backgrounds: Gradient, pattern, and solid color options using BrushInfo
- Office2016 Themes: Colorful, White, Black, and DarkGray theme support
- Border Customization: 2D and 3D border styles with custom colors
- Panel Alignment: Center, Near, Far, and custom positioning options
- Auto-Sizing: Automatic height adjustment for panels
- Metro Style: Modern flat design option
- Sizing Grip: Resizable form indicator
- Child Controls: Add any WinForms control to the status bar
Assembly: Syncfusion.Tools.Windows
Dependencies: Syncfusion.Shared.Base, Syncfusion.Tools.Windows
Namespace:
Dependencies: Syncfusion.Shared.Base, Syncfusion.Tools.Windows
Namespace:
Syncfusion.Windows.Forms.ToolsStatusBarAdv是一款高级状态栏控件,在标准Windows Forms StatusBar的基础上扩展了以下能力:
- StatusBarAdvPanel集合:可添加多个支持自定义内容和样式的面板
- 增强背景效果:通过BrushInfo支持渐变、图案、纯色三种背景选项
- Office2016主题:支持多彩、白色、黑色、深灰色四种主题
- 边框自定义:支持2D、3D边框样式,可自定义边框颜色
- 面板对齐:支持居中、近对齐、远对齐和自定义定位选项
- 自动尺寸调整:支持面板高度自动适配
- Metro风格:支持现代扁平化设计风格
- 尺寸调整手柄:展示可调整窗体大小的指示器
- 子控件支持:可向状态栏添加任意WinForms控件
程序集: 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 StatusBarAdv, setting up assemblies, or creating basic status bars.
- Assembly requirements and installation
- NuGet package installation
- Designer-based setup with toolbox
- Programmatic creation and initialization
- Adding StatusBarAdvPanel controls
- Basic configuration and docking
- Troubleshooting common setup issues
📄 阅读: references/getting-started.md
适用场景: 首次实现StatusBarAdv、配置程序集或创建基础状态栏时阅读。
- 程序集要求和安装方法
- NuGet包安装方式
- 基于设计器和工具箱的配置方式
- 编程式创建和初始化方法
- 添加StatusBarAdvPanel控件
- 基础配置和停靠设置
- 常见安装问题排查
Panels and Layout
面板和布局
📄 Read: references/panels-and-layout.md
When to read: Managing multiple panels, configuring spacing, customizing panel alignment, or positioning controls.
- StatusBarAdvPanel collection management
- Panel spacing configuration
- CustomLayoutBounds for panel sizing
- Alignment options (Center, Near, Far, ChildConstraints)
- SetHAlign method for horizontal alignment
- Panel positioning and sizing
- Adding child controls to StatusBarAdv
- Layout customization patterns
📄 阅读: references/panels-and-layout.md
适用场景: 管理多面板、配置间距、自定义面板对齐方式或控件定位时阅读。
- StatusBarAdvPanel集合管理
- 面板间距配置
- 用于面板尺寸设置的CustomLayoutBounds属性
- 对齐选项(居中、近对齐、远对齐、子控件约束)
- 用于水平对齐设置的SetHAlign方法
- 面板定位和尺寸调整
- 向StatusBarAdv添加子控件
- 布局自定义模式
Appearance and Styling
外观和样式
📄 Read: references/appearance-styling.md
When to read: Customizing status bar appearance, applying gradients, setting colors, or adding sizing grip.
- BackgroundColor property with BrushInfo
- Gradient backgrounds (6 gradient styles)
- Pattern styles and solid colors
- GradientColors array configuration
- MetroColor and UseMetroColorAsBorder
- ForeColor customization
- SizingGrip display
- Complete styling examples
📄 阅读: references/appearance-styling.md
适用场景: 自定义状态栏外观、应用渐变效果、设置颜色或添加尺寸调整手柄时阅读。
- 搭配BrushInfo使用的BackgroundColor属性
- 渐变背景(6种渐变样式)
- 图案样式和纯色背景
- GradientColors数组配置
- MetroColor和UseMetroColorAsBorder属性
- 前景色自定义
- 尺寸调整手柄显示设置
- 完整样式示例
Borders and Themes
边框和主题
📄 Read: references/borders-and-themes.md
When to read: Applying borders, using Office2016 themes, enabling Metro style, or configuring themed backgrounds.
- BorderStyle property (None, FixedSingle, Fixed3D)
- Border3DStyle options (10 styles)
- 2D border configuration (BorderColor, BorderSingle, BorderSides)
- Office2016 themes (Colorful, White, Black, DarkGray)
- Metro style application
- ThemesEnabled and IgnoreThemeBackground
- Complete themed examples
📄 阅读: references/borders-and-themes.md
适用场景: 应用边框、使用Office2016主题、启用Metro风格或配置主题背景时阅读。
- BorderStyle属性(无、单实线边框、3D边框)
- Border3DStyle选项(10种样式:凸起、凹陷等)
- 2D边框配置(BorderColor、BorderSingle、BorderSides)
- Office2016主题(多彩、白色、黑色、深灰色)
- Metro风格应用
- ThemesEnabled和IgnoreThemeBackground属性
- 完整主题示例
Events and Behavior
事件和行为
📄 Read: references/events-and-behavior.md
When to read: Implementing auto-sizing, handling property change events, or responding to border/gradient changes.
- AutoSize and AutoSizeMode configuration
- AutoHeightControls for panel height
- GetPreferredSize and SetPreferredSize methods
- 9 property change events
- BorderSidesChanged, BorderColorChanged events
- GradientBackgroundChanged event
- ThemeChanged event
- Event handling patterns
📄 阅读: references/events-and-behavior.md
适用场景: 实现自动尺寸调整、处理属性变更事件或响应边框/渐变变更时阅读。
- AutoSize和AutoSizeMode配置
- 用于面板高度调整的AutoHeightControls属性
- GetPreferredSize和SetPreferredSize方法
- 9种属性变更事件
- BorderSidesChanged、BorderColorChanged事件
- GradientBackgroundChanged事件
- ThemeChanged事件
- 事件处理模式
Quick Start Example
快速上手示例
Basic StatusBarAdv with Panels
带面板的基础StatusBarAdv
C#:
csharp
using Syncfusion.Windows.Forms.Tools;
using System.Drawing;
using System.Windows.Forms;
public partial class MainForm : Form
{
private StatusBarAdv statusBarAdv1;
private StatusBarAdvPanel culturePanel;
private StatusBarAdvPanel datePanel;
private StatusBarAdvPanel timePanel;
public MainForm()
{
InitializeComponent();
SetupStatusBar();
}
private void SetupStatusBar()
{
// Create StatusBarAdv
statusBarAdv1 = new StatusBarAdv
{
Dock = DockStyle.Bottom,
BackColor = Color.LightSteelBlue,
BorderColor = Color.DarkSlateGray,
BorderStyle = BorderStyle.FixedSingle,
SizingGrip = true
};
// Create panels
culturePanel = new StatusBarAdvPanel
{
PanelType = StatusBarAdvPanelType.CurrentCulture,
Size = new Size(120, 27)
};
datePanel = new StatusBarAdvPanel
{
PanelType = StatusBarAdvPanelType.ShortDate,
Size = new Size(100, 27)
};
timePanel = new StatusBarAdvPanel
{
PanelType = StatusBarAdvPanelType.ShortTime,
Size = new Size(100, 27)
};
// Add panels to StatusBarAdv
statusBarAdv1.Controls.Add(culturePanel);
statusBarAdv1.Controls.Add(datePanel);
statusBarAdv1.Controls.Add(timePanel);
// Add to form
this.Controls.Add(statusBarAdv1);
}
}VB.NET:
vbnet
Imports Syncfusion.Windows.Forms.Tools
Imports System.Drawing
Imports System.Windows.Forms
Public Partial Class MainForm
Inherits Form
Private statusBarAdv1 As StatusBarAdv
Private culturePanel As StatusBarAdvPanel
Private datePanel As StatusBarAdvPanel
Private timePanel As StatusBarAdvPanel
Public Sub New()
InitializeComponent()
SetupStatusBar()
End Sub
Private Sub SetupStatusBar()
' Create StatusBarAdv
statusBarAdv1 = New StatusBarAdv With {
.Dock = DockStyle.Bottom,
.BackColor = Color.LightSteelBlue,
.BorderColor = Color.DarkSlateGray,
.BorderStyle = BorderStyle.FixedSingle,
.SizingGrip = True
}
' Create panels
culturePanel = New StatusBarAdvPanel With {
.PanelType = StatusBarAdvPanelType.CurrentCulture,
.Size = New Size(120, 27)
}
datePanel = New StatusBarAdvPanel With {
.PanelType = StatusBarAdvPanelType.ShortDate,
.Size = New Size(100, 27)
}
timePanel = New StatusBarAdvPanel With {
.PanelType = StatusBarAdvPanelType.ShortTime,
.Size = New Size(100, 27)
}
' Add panels to StatusBarAdv
statusBarAdv1.Controls.Add(culturePanel)
statusBarAdv1.Controls.Add(datePanel)
statusBarAdv1.Controls.Add(timePanel)
' Add to form
Me.Controls.Add(statusBarAdv1)
End Sub
End ClassC#:
csharp
using Syncfusion.Windows.Forms.Tools;
using System.Drawing;
using System.Windows.Forms;
public partial class MainForm : Form
{
private StatusBarAdv statusBarAdv1;
private StatusBarAdvPanel culturePanel;
private StatusBarAdvPanel datePanel;
private StatusBarAdvPanel timePanel;
public MainForm()
{
InitializeComponent();
SetupStatusBar();
}
private void SetupStatusBar()
{
// Create StatusBarAdv
statusBarAdv1 = new StatusBarAdv
{
Dock = DockStyle.Bottom,
BackColor = Color.LightSteelBlue,
BorderColor = Color.DarkSlateGray,
BorderStyle = BorderStyle.FixedSingle,
SizingGrip = true
};
// Create panels
culturePanel = new StatusBarAdvPanel
{
PanelType = StatusBarAdvPanelType.CurrentCulture,
Size = new Size(120, 27)
};
datePanel = new StatusBarAdvPanel
{
PanelType = StatusBarAdvPanelType.ShortDate,
Size = new Size(100, 27)
};
timePanel = new StatusBarAdvPanel
{
PanelType = StatusBarAdvPanelType.ShortTime,
Size = new Size(100, 27)
};
// Add panels to StatusBarAdv
statusBarAdv1.Controls.Add(culturePanel);
statusBarAdv1.Controls.Add(datePanel);
statusBarAdv1.Controls.Add(timePanel);
// Add to form
this.Controls.Add(statusBarAdv1);
}
}VB.NET:
vbnet
Imports Syncfusion.Windows.Forms.Tools
Imports System.Drawing
Imports System.Windows.Forms
Public Partial Class MainForm
Inherits Form
Private statusBarAdv1 As StatusBarAdv
Private culturePanel As StatusBarAdvPanel
Private datePanel As StatusBarAdvPanel
Private timePanel As StatusBarAdvPanel
Public Sub New()
InitializeComponent()
SetupStatusBar()
End Sub
Private Sub SetupStatusBar()
' Create StatusBarAdv
statusBarAdv1 = New StatusBarAdv With {
.Dock = DockStyle.Bottom,
.BackColor = Color.LightSteelBlue,
.BorderColor = Color.DarkSlateGray,
.BorderStyle = BorderStyle.FixedSingle,
.SizingGrip = True
}
' Create panels
culturePanel = New StatusBarAdvPanel With {
.PanelType = StatusBarAdvPanelType.CurrentCulture,
.Size = New Size(120, 27)
}
datePanel = New StatusBarAdvPanel With {
.PanelType = StatusBarAdvPanelType.ShortDate,
.Size = New Size(100, 27)
}
timePanel = New StatusBarAdvPanel With {
.PanelType = StatusBarAdvPanelType.ShortTime,
.Size = New Size(100, 27)
}
' Add panels to StatusBarAdv
statusBarAdv1.Controls.Add(culturePanel)
statusBarAdv1.Controls.Add(datePanel)
statusBarAdv1.Controls.Add(timePanel)
' Add to form
Me.Controls.Add(statusBarAdv1)
End Sub
End ClassCommon Patterns
常用模式
1. Gradient Background with Metro Theme
1. 搭配Metro主题的渐变背景
Apply a modern gradient background with Metro styling:
csharp
using Syncfusion.Drawing;
// Set gradient background
statusBarAdv1.BackgroundColor = new BrushInfo(
GradientStyle.Horizontal,
Color.AliceBlue,
Color.LightSteelBlue
);
// Apply Metro style
statusBarAdv1.Style = StatusbarStyle.Metro;
// Set metro accent color
statusBarAdv1.MetroColor = ColorTranslator.FromHtml("#16a5dc");
statusBarAdv1.UseMetroColorAsBorder = true;应用带有Metro样式的现代渐变背景:
csharp
using Syncfusion.Drawing;
// Set gradient background
statusBarAdv1.BackgroundColor = new BrushInfo(
GradientStyle.Horizontal,
Color.AliceBlue,
Color.LightSteelBlue
);
// Apply Metro style
statusBarAdv1.Style = StatusbarStyle.Metro;
// Set metro accent color
statusBarAdv1.MetroColor = ColorTranslator.FromHtml("#16a5dc");
statusBarAdv1.UseMetroColorAsBorder = true;2. Custom Panel Alignment
2. 自定义面板对齐
Align panels with custom positioning using ChildConstraints:
csharp
// Enable custom alignment
statusBarAdv1.Alignment = FlowAlignment.ChildConstraints;
// Left-align first panel
statusBarAdv1.SetHAlign(panel1, HorzFlowAlign.Left);
// Right-align second panel
statusBarAdv1.SetHAlign(panel2, HorzFlowAlign.Right);
// Justify third panel to fill space
statusBarAdv1.SetHAlign(panel3, HorzFlowAlign.Justify);使用ChildConstraints实现自定义面板定位:
csharp
// Enable custom alignment
statusBarAdv1.Alignment = FlowAlignment.ChildConstraints;
// Left-align first panel
statusBarAdv1.SetHAlign(panel1, HorzFlowAlign.Left);
// Right-align second panel
statusBarAdv1.SetHAlign(panel2, HorzFlowAlign.Right);
// Justify third panel to fill space
statusBarAdv1.SetHAlign(panel3, HorzFlowAlign.Justify);3. Office2016 Theme with Auto-Sizing
3. 带自动尺寸调整的Office2016主题
Apply Office2016 theme with automatic height adjustment:
csharp
// Apply Office2016 Colorful theme
statusBarAdv1.Style = StatusbarStyle.Office2016Colorful;
// Enable auto-sizing
statusBarAdv1.AutoSize = true;
statusBarAdv1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
// Auto-adjust panel heights
statusBarAdv1.AutoHeightControls = true;应用Office2016主题并开启高度自动适配:
csharp
// Apply Office2016 Colorful theme
statusBarAdv1.Style = StatusbarStyle.Office2016Colorful;
// Enable auto-sizing
statusBarAdv1.AutoSize = true;
statusBarAdv1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
// Auto-adjust panel heights
statusBarAdv1.AutoHeightControls = true;Key Properties
核心属性
StatusBarAdv Properties
StatusBarAdv属性
| Property | Type | Description |
|---|---|---|
| BrushInfo | Background gradient, pattern, or solid color configuration |
| BorderStyle | Border type: None, FixedSingle, or Fixed3D |
| Border3DStyle | 3D border style (10 options: Raised, Sunken, etc.) |
| Color | 2D border color (requires BorderStyle.FixedSingle) |
| ButtonBorderStyle | 2D border style: Solid, Dashed, Dotted, etc. |
| Border3DSide | Border sides to display: Left, Top, Right, Bottom, All |
| StatusbarStyle | Theme: Default, Metro, Office2016Colorful, Office2016White, Office2016Black, Office2016DarkGray |
| Collection | StatusBarAdvPanel controls in the StatusBarAdv |
| FlowAlignment | Panel alignment: Center, Near, Far, ChildConstraints |
| Size | Space between panels |
| Rectangle | Custom rectangle for panel layout |
| bool | Display sizing grip for resizable forms |
| bool | Automatically resize to fit contents |
| AutoSizeMode | Resize mode: GrowAndShrink or GrowOnly |
| bool | Auto-adjust panel heights to StatusBarAdv height |
| Color | Metro theme accent color |
| bool | Use MetroColor as border color |
| bool | Enable themed background drawing |
| bool | Ignore theme background and use BackColor instead |
| 属性 | 类型 | 描述 |
|---|---|---|
| BrushInfo | 背景渐变、图案或纯色配置 |
| BorderStyle | 边框类型:无、单实线边框、3D边框 |
| Border3DStyle | 3D边框样式(10种选项:凸起、凹陷等) |
| Color | 2D边框颜色(需搭配BorderStyle.FixedSingle使用) |
| ButtonBorderStyle | 2D边框样式:实线、虚线、点线等 |
| Border3DSide | 要展示的边框边:左、上、右、下、全部 |
| StatusbarStyle | 主题:默认、Metro、Office2016多彩、Office2016白色、Office2016黑色、Office2016深灰 |
| Collection | StatusBarAdv中的StatusBarAdvPanel控件集合 |
| FlowAlignment | 面板对齐方式:居中、近对齐、远对齐、子控件约束 |
| Size | 面板之间的间距 |
| Rectangle | 面板布局的自定义矩形区域 |
| bool | 展示用于调整窗体大小的尺寸调整手柄 |
| bool | 自动调整尺寸以适配内容 |
| AutoSizeMode | 调整模式:可增长可缩小、仅可增长 |
| bool | 自动调整面板高度以适配StatusBarAdv高度 |
| Color | Metro主题强调色 |
| bool | 使用MetroColor作为边框颜色 |
| bool | 开启主题背景绘制 |
| bool | 忽略主题背景,优先使用BackColor |
StatusBarAdvPanel Properties
StatusBarAdvPanel属性
| Property | Type | Description |
|---|---|---|
| StatusBarAdvPanelType | Panel content type: CurrentCulture, ShortDate, ShortTime, etc. |
| Size | Panel dimensions |
| string | Custom text to display in panel |
| HorzFlowAlign | Horizontal alignment: Left, Center, Right, Justify |
| 属性 | 类型 | 描述 |
|---|---|---|
| StatusBarAdvPanelType | 面板内容类型:当前区域文化、短日期、短时间等 |
| Size | 面板尺寸 |
| string | 面板中展示的自定义文本 |
| HorzFlowAlign | 水平对齐方式:左对齐、居中、右对齐、两端对齐 |
Common Use Cases
常见使用场景
- Application Status Display: Show ready state, connection status, or operation progress
- Date/Time Information: Display current date and time using built-in panel types
- Culture and Localization: Show current culture information with CurrentCulture panel
- Progress Indicators: Add ProgressBar controls to status bar for long operations
- Document Information: Display file name, line/column position, or word count
- Network Status: Show connectivity state or server status with custom panels
- User Session Info: Display logged-in user name or session details
- Themed Applications: Apply Office2016 or Metro themes for consistent UI
- 应用状态展示:展示就绪状态、连接状态或操作进度
- 日期/时间信息:使用内置面板类型展示当前日期和时间
- 区域文化和本地化:通过CurrentCulture面板展示当前区域文化信息
- 进度指示器:向状态栏添加ProgressBar控件展示长时间操作进度
- 文档信息:展示文件名、行列位置或字数统计
- 网络状态:通过自定义面板展示连接状态或服务端状态
- 用户会话信息:展示登录用户名或会话详情
- 主题化应用:应用Office2016或Metro主题保持UI风格统一
Additional Resources
额外资源
- Syncfusion Documentation: StatusBarAdv Official Docs
- Panel Reference: See StatusBarAdvPanel documentation for panel-specific properties
- Theme Support: StatusBarAdv supports VisualStyleManager for application-wide theming
- Syncfusion官方文档:StatusBarAdv官方文档
- 面板参考:查看StatusBarAdvPanel文档了解面板专属属性
- 主题支持:StatusBarAdv支持通过VisualStyleManager实现应用全局主题设置
Next Steps
后续步骤
After implementing basic StatusBarAdv:
- Add Multiple Panels → Read: references/panels-and-layout.md
- Customize Appearance → Read: references/appearance-styling.md
- Apply Themes → Read: references/borders-and-themes.md
实现基础StatusBarAdv后可以进行以下操作:
- 添加多面板 → 阅读:references/panels-and-layout.md
- 自定义外观 → 阅读:references/appearance-styling.md
- 应用主题 → 阅读:references/borders-and-themes.md