syncfusion-winforms-statusstrip

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Implementing Syncfusion WinForms StatusStripEx

实现Syncfusion WinForms StatusStripEx

The StatusStripEx control provides an enhanced status strip that can be added to the bottom of forms or Ribbon controls. It supports various item types, Office themes, custom colors, and flexible positioning for creating professional status bars.
StatusStripEx控件提供了增强版的状态栏,可以添加到窗体或Ribbon控件的底部。它支持多种项类型、Office主题、自定义颜色和灵活的定位能力,可用于创建专业的状态栏。

When to Use This Skill

何时使用本技能

Use this skill when the user needs to:
  • Application Status Bars: Display application status, user info, or system state at bottom of form
  • Progress Indicators: Show progress bars or loading indicators in status strip
  • Ribbon Status Strips: Add status bar to bottom of RibbonControlAdv
  • Left/Right Alignment: Different item types for left-aligned (notifications) vs right-aligned (status)
  • Themed Status Bars: Office2007 (Silver/Blue/Black) or Office2016 themes
  • Custom Status Items: Buttons, labels, dropdowns, split buttons, progress bars, trackbars
  • Sizing Grip: Resizable form indicator with customizable grip appearance
  • Status Information: Display file info, record counts, zoom levels, connection status
  • Word-Style Context Menu: Custom context menu for status items
当用户需要实现以下需求时可以使用本技能:
  • 应用状态栏: 在窗体底部展示应用状态、用户信息或系统状态
  • 进度指示器: 在状态栏中展示进度条或加载指示器
  • Ribbon状态栏: 给RibbonControlAdv的底部添加状态栏
  • 左/右对齐: 不同类型的项分别左对齐(通知)和右对齐(状态)展示
  • 主题化状态栏: 支持Office2007(银色/蓝色/黑色)或Office2016主题
  • 自定义状态项: 按钮、标签、下拉框、拆分按钮、进度条、轨道条
  • 大小调整手柄: 可调整大小的窗体指示器,支持自定义手柄外观
  • 状态信息: 展示文件信息、记录数、缩放级别、连接状态
  • Word风格上下文菜单: 为状态项提供自定义上下文菜单

Component Overview

组件概述

StatusStripEx (
Syncfusion.Windows.Forms.Tools.StatusStripEx
) is an enhanced status strip control supporting:
  • Two Item Types:
    • StatusControl Items: Right-aligned (StatusLabel, ProgressBar, DropDownButton, SplitButton, PanelItem, TrackBarItem)
    • Notification Items: Left-aligned (StatusStripButton, StatusStripLabel, StatusStripProgressBar, etc.)
  • Office2007 Color Schemes: Silver, Blue, Black
  • Office2016 Visual Styles: Colorful, White, Black, DarkGray
  • Custom Managed Colors: Apply custom color themes
  • Sizing Grip: Customizable resize grip at bottom-right corner
  • Smart Tag Support: Quick item addition via designer
  • Custom Context Menu: Word2007-style status bar context menu
  • Ribbon Integration: Works seamlessly with RibbonControlAdv
Key Namespace:
Syncfusion.Windows.Forms.Tools
Assembly:
Syncfusion.Tools.Windows.dll
(and dependencies)

StatusStripEx
Syncfusion.Windows.Forms.Tools.StatusStripEx
)是增强版的状态栏控件,支持以下功能:
  • 两种项类型:
    • StatusControl项: 右对齐(StatusLabel、ProgressBar、DropDownButton、SplitButton、PanelItem、TrackBarItem)
    • Notification项: 左对齐(StatusStripButton、StatusStripLabel、StatusStripProgressBar等)
  • Office2007配色方案: 银色、蓝色、黑色
  • Office2016视觉样式: 彩色、白色、黑色、深灰
  • 自定义托管颜色: 可应用自定义颜色主题
  • 大小调整手柄: 右下角可自定义的调整大小手柄
  • 智能标签支持: 通过设计器快速添加项
  • 自定义上下文菜单: Word2007风格的状态栏上下文菜单
  • Ribbon集成: 可与RibbonControlAdv无缝协作
核心命名空间:
Syncfusion.Windows.Forms.Tools
程序集:
Syncfusion.Tools.Windows.dll
(及相关依赖)

Documentation and Navigation Guide

文档和导航指南

Getting Started

入门指南

📄 Read: references/getting-started.md
When to read: User needs to install, configure, or create their first StatusStripEx.
Topics covered:
  • Assembly deployment and NuGet package installation
  • Adding StatusStripEx via designer (toolbox)
  • Adding StatusStripEx via code
  • Docking to bottom of form or Ribbon
  • Items Collection Editor for adding items
  • Smart tag support for quick item addition
  • Basic status strip setup
📄 阅读: references/getting-started.md
适用场景: 用户需要安装、配置或创建第一个StatusStripEx时。
涵盖内容:
  • 程序集部署和NuGet包安装
  • 通过设计器(工具箱)添加StatusStripEx
  • 通过代码添加StatusStripEx
  • 停靠到窗体或Ribbon的底部
  • 使用项集合编辑器添加项
  • 智能标签支持快速添加项
  • 基础状态栏设置

Status Items and Collections

状态项和集合

📄 Read: references/status-items.md
When to read: User wants to add status labels, progress bars, buttons, or understand item positioning.
Topics covered:
  • StatusControl items (right-aligned): StatusLabel, ProgressBar, DropDownButton, SplitButton, PanelItem, TrackBarItem
  • Notification items (left-aligned): StatusStripButton, StatusStripLabel, StatusStripProgressBar, StatusStripDropDownButton, etc.
  • Difference between StatusControl and Notification items
  • Adding items programmatically via Items collection
  • Item positioning and alignment strategies
  • Using different item types effectively
📄 阅读: references/status-items.md
适用场景: 用户想要添加状态标签、进度条、按钮,或者了解项的定位规则时。
涵盖内容:
  • StatusControl项(右对齐):StatusLabel、ProgressBar、DropDownButton、SplitButton、PanelItem、TrackBarItem
  • Notification项(左对齐):StatusStripButton、StatusStripLabel、StatusStripProgressBar、StatusStripDropDownButton等
  • StatusControl和Notification项的区别
  • 通过Items集合以编程方式添加项
  • 项的定位和对齐策略
  • 不同类型项的有效使用方式

Sizing Grip Customization

大小调整手柄自定义

📄 Read: references/sizing-grip.md
When to read: User needs to show/hide sizing grip or customize grip appearance.
Topics covered:
  • Sizing grip overview and purpose
  • SizingGrip property (true/false)
  • GripStyle property (Visible, Hidden)
  • GripMargin property for spacing
  • Customizing grip appearance
  • When to show or hide sizing grip
📄 阅读: references/sizing-grip.md
适用场景: 用户需要显示/隐藏大小调整手柄或自定义手柄外观时。
涵盖内容:
  • 大小调整手柄概述和用途
  • SizingGrip属性(true/false)
  • GripStyle属性(Visible、Hidden)
  • 用于调整间距的GripMargin属性
  • 自定义手柄外观
  • 显示或隐藏大小调整手柄的场景

Styling and Appearance

样式和外观

📄 Read: references/styling-and-appearance.md
When to read: User wants Office2007/2016 themes or custom status bar colors.
Topics covered:
  • Office2007 color schemes (Silver, Blue, Black)
  • OfficeColorScheme property usage
  • Office2016 visual styles (Colorful, White, Black, DarkGray)
  • VisualStyle property configuration
  • Custom managed colors with ApplyManagedColors
  • Custom context menu (Word2007-style)
  • StatusString property for context menu items

📄 阅读: references/styling-and-appearance.md
适用场景: 用户想要使用Office2007/2016主题或自定义状态栏颜色时。
涵盖内容:
  • Office2007配色方案(银色、蓝色、黑色)
  • OfficeColorScheme属性的使用
  • Office2016视觉样式(彩色、白色、黑色、深灰)
  • VisualStyle属性配置
  • 使用ApplyManagedColors设置自定义托管颜色
  • 自定义上下文菜单(Word2007风格)
  • 上下文菜单项的StatusString属性

Quick Start Example

快速入门示例

Basic StatusStripEx with Items

带有项的基础StatusStripEx

csharp
using Syncfusion.Windows.Forms.Tools;
using System.Windows.Forms;

// Create StatusStripEx
StatusStripEx statusStripEx1 = new StatusStripEx();

// Create status label (right-aligned)
ToolStripStatusLabel statusLabel = new ToolStripStatusLabel();
statusLabel.Text = "Ready";

// Create progress bar (right-aligned)
ToolStripProgressBar progressBar = new ToolStripProgressBar();
progressBar.Value = 50;

// Add items to StatusStripEx
statusStripEx1.Items.AddRange(new ToolStripItem[] {
    statusLabel,
    progressBar
});

// Dock to bottom
statusStripEx1.Dock = DockStyleEx.Bottom;

// Add to form
this.Controls.Add(statusStripEx1);
csharp
using Syncfusion.Windows.Forms.Tools;
using System.Windows.Forms;

// 创建StatusStripEx
StatusStripEx statusStripEx1 = new StatusStripEx();

// 创建状态标签(右对齐)
ToolStripStatusLabel statusLabel = new ToolStripStatusLabel();
statusLabel.Text = "Ready";

// 创建进度条(右对齐)
ToolStripProgressBar progressBar = new ToolStripProgressBar();
progressBar.Value = 50;

// 给StatusStripEx添加项
statusStripEx1.Items.AddRange(new ToolStripItem[] {
    statusLabel,
    progressBar
});

// 停靠到底部
statusStripEx1.Dock = DockStyleEx.Bottom;

// 添加到窗体
this.Controls.Add(statusStripEx1);

StatusStripEx with Office2016 Theme

使用Office2016主题的StatusStripEx

csharp
// Apply Office2016 Colorful theme
statusStripEx1.VisualStyle = StatusStripExStyle.Office2016Colorful;

// Enable sizing grip
statusStripEx1.SizingGrip = true;
statusStripEx1.GripStyle = ToolStripGripStyle.Visible;

csharp
// 应用Office2016彩色主题
statusStripEx1.VisualStyle = StatusStripExStyle.Office2016Colorful;

// 启用大小调整手柄
statusStripEx1.SizingGrip = true;
statusStripEx1.GripStyle = ToolStripGripStyle.Visible;

Common Patterns

常用模式

Application Status Bar with Multiple Items

包含多个项的应用状态栏

csharp
// Create StatusStripEx
StatusStripEx statusBar = new StatusStripEx();
statusBar.Dock = DockStyleEx.Bottom;

// Left-aligned notification item
ToolStripStatusLabel notificationLabel = new ToolStripStatusLabel();
notificationLabel.Text = "Connection: Active";
notificationLabel.Spring = true;  // Fill available space

// Right-aligned status items
ToolStripStatusLabel recordLabel = new ToolStripStatusLabel();
recordLabel.Text = "Records: 1,234";

ToolStripProgressBar loadingProgress = new ToolStripProgressBar();
loadingProgress.Visible = false;  // Show when loading

ToolStripStatusLabel zoomLabel = new ToolStripStatusLabel();
zoomLabel.Text = "Zoom: 100%";

// Add all items
statusBar.Items.AddRange(new ToolStripItem[] {
    notificationLabel,
    recordLabel,
    loadingProgress,
    zoomLabel
});

this.Controls.Add(statusBar);
When to use: Multi-purpose status bar showing various application states.
csharp
// 创建StatusStripEx
StatusStripEx statusBar = new StatusStripEx();
statusBar.Dock = DockStyleEx.Bottom;

// 左对齐通知项
ToolStripStatusLabel notificationLabel = new ToolStripStatusLabel();
notificationLabel.Text = "Connection: Active";
notificationLabel.Spring = true;  // 填充可用空间

// 右对齐状态项
ToolStripStatusLabel recordLabel = new ToolStripStatusLabel();
recordLabel.Text = "Records: 1,234";

ToolStripProgressBar loadingProgress = new ToolStripProgressBar();
loadingProgress.Visible = false;  // 加载时显示

ToolStripStatusLabel zoomLabel = new ToolStripStatusLabel();
zoomLabel.Text = "Zoom: 100%";

// 添加所有项
statusBar.Items.AddRange(new ToolStripItem[] {
    notificationLabel,
    recordLabel,
    loadingProgress,
    zoomLabel
});

this.Controls.Add(statusBar);
适用场景: 需要展示多种应用状态的多用途状态栏。

Progress Indicator in Status Bar

状态栏中的进度指示器

csharp
// Status bar with progress tracking
StatusStripEx statusBar = new StatusStripEx();

ToolStripStatusLabel statusText = new ToolStripStatusLabel();
statusText.Text = "Processing...";

ToolStripProgressBar progressBar = new ToolStripProgressBar();
progressBar.Style = ProgressBarStyle.Continuous;
progressBar.Maximum = 100;

statusBar.Items.AddRange(new ToolStripItem[] { statusText, progressBar });
statusBar.Dock = DockStyleEx.Bottom;

// Update progress
void UpdateProgress(int percent)
{
    progressBar.Value = percent;
    statusText.Text = $"Processing... {percent}%";
}
When to use: Long-running operations requiring progress feedback.
csharp
// 带进度追踪的状态栏
StatusStripEx statusBar = new StatusStripEx();

ToolStripStatusLabel statusText = new ToolStripStatusLabel();
statusText.Text = "Processing...";

ToolStripProgressBar progressBar = new ToolStripProgressBar();
progressBar.Style = ProgressBarStyle.Continuous;
progressBar.Maximum = 100;

statusBar.Items.AddRange(new ToolStripItem[] { statusText, progressBar });
statusBar.Dock = DockStyleEx.Bottom;

// 更新进度
void UpdateProgress(int percent)
{
    progressBar.Value = percent;
    statusText.Text = $"Processing... {percent}%";
}
适用场景: 需要进度反馈的长时间运行操作。

Ribbon with StatusStripEx

带StatusStripEx的Ribbon

csharp
// StatusStripEx at bottom of Ribbon form
StatusStripEx ribbonStatusBar = new StatusStripEx();
ribbonStatusBar.Dock = DockStyleEx.Bottom;

// Apply matching Office2016 theme
ribbonStatusBar.VisualStyle = StatusStripExStyle.Office2016Colorful;

// Add status items
ToolStripStatusLabel pageLabel = new ToolStripStatusLabel();
pageLabel.Text = "Page 1 of 10";

ToolStripStatusLabel wordCount = new ToolStripStatusLabel();
wordCount.Text = "Words: 245";

ribbonStatusBar.Items.AddRange(new ToolStripItem[] { pageLabel, wordCount });

// Add to form (ensure it's added after Ribbon)
this.Controls.Add(ribbonStatusBar);
When to use: Ribbon-based applications requiring status information.
csharp
// Ribbon窗体底部的StatusStripEx
StatusStripEx ribbonStatusBar = new StatusStripEx();
ribbonStatusBar.Dock = DockStyleEx.Bottom;

// 应用匹配的Office2016主题
ribbonStatusBar.VisualStyle = StatusStripExStyle.Office2016Colorful;

// 添加状态项
ToolStripStatusLabel pageLabel = new ToolStripStatusLabel();
pageLabel.Text = "Page 1 of 10";

ToolStripStatusLabel wordCount = new ToolStripStatusLabel();
wordCount.Text = "Words: 245";

ribbonStatusBar.Items.AddRange(new ToolStripItem[] { pageLabel, wordCount });

// 添加到窗体(确保在Ribbon之后添加)
this.Controls.Add(ribbonStatusBar);
适用场景: 需要展示状态信息的基于Ribbon的应用。

Custom Themed Status Bar

自定义主题的状态栏

csharp
// Apply custom managed color
statusStripEx1.OfficeColorScheme = ToolStripEx.ColorScheme.Managed;
Office2007Colors.ApplyManagedColors(this, Color.DarkBlue);

// Custom context menu for status items
ToolStripStatusLabel statusLabel = new ToolStripStatusLabel();
statusLabel.Text = "Pages";
statusLabel.StatusString = "1/1";  // Shows in Word-style context menu
When to use: Branded applications with custom color schemes.

csharp
// 应用自定义托管颜色
statusStripEx1.OfficeColorScheme = ToolStripEx.ColorScheme.Managed;
Office2007Colors.ApplyManagedColors(this, Color.DarkBlue);

// 状态项的自定义上下文菜单
ToolStripStatusLabel statusLabel = new ToolStripStatusLabel();
statusLabel.Text = "Pages";
statusLabel.StatusString = "1/1";  // 显示在Word风格的上下文菜单中
适用场景: 带有自定义配色方案的品牌化应用。

Key Properties

核心属性

Core Properties

基础属性

PropertyTypeDescriptionWhen to Use
Items
ToolStripItemCollection
Collection of status itemsAdd/manage status strip items
Dock
DockStyleEx
Docking position (Bottom)Position status strip at bottom
SizingGrip
bool
Show/hide sizing gripEnable form resizing indicator
GripStyle
ToolStripGripStyle
Grip visibility styleCustomize grip appearance
GripMargin
Padding
Grip margin spacingAdjust grip positioning
属性类型描述适用场景
Items
ToolStripItemCollection
状态项集合添加/管理状态栏项
Dock
DockStyleEx
停靠位置(底部)将状态栏定位到底部
SizingGrip
bool
显示/隐藏大小调整手柄启用窗体大小调整指示器
GripStyle
ToolStripGripStyle
手柄可见性样式自定义手柄外观
GripMargin
Padding
手柄边距间距调整手柄定位

Styling Properties

样式属性

PropertyTypeDescriptionWhen to Use
VisualStyle
StatusStripExStyle
Office2016 visual styleApply Office2016 themes
OfficeColorScheme
ColorScheme
Office2007 color schemeApply Silver/Blue/Black themes
属性类型描述适用场景
VisualStyle
StatusStripExStyle
Office2016视觉样式应用Office2016主题
OfficeColorScheme
ColorScheme
Office2007配色方案应用银色/蓝色/黑色主题

Item Types

项类型

StatusControl Items (Right-Aligned):
  • StatusLabel
    - Text label for status information
  • ProgressBar
    - Progress indicator
  • DropDownButton
    - Dropdown button for options
  • SplitButton
    - Split button with dropdown
  • PanelItem
    - Custom panel container
  • TrackBarItem
    - Slider control
Notification Items (Left-Aligned):
  • StatusStripButton
    - Button control
  • StatusStripLabel
    - Text label
  • StatusStripProgressBar
    - Progress indicator
  • StatusStripDropDownButton
    - Dropdown button
  • StatusStripSplitButton
    - Split button
  • StatusStripPanelItem
    - Custom panel

StatusControl项(右对齐):
  • StatusLabel
    - 展示状态信息的文本标签
  • ProgressBar
    - 进度指示器
  • DropDownButton
    - 展示选项的下拉按钮
  • SplitButton
    - 带下拉功能的拆分按钮
  • PanelItem
    - 自定义面板容器
  • TrackBarItem
    - 滑块控件
Notification项(左对齐):
  • StatusStripButton
    - 按钮控件
  • StatusStripLabel
    - 文本标签
  • StatusStripProgressBar
    - 进度指示器
  • StatusStripDropDownButton
    - 下拉按钮
  • StatusStripSplitButton
    - 拆分按钮
  • StatusStripPanelItem
    - 自定义面板

Common Use Cases

常见使用场景

1. Document Editor Status Bar

1. 文档编辑器状态栏

Scenario: Word-like editor showing page, word count, zoom.
  • Add StatusLabel for page number (e.g., "Page 1 of 5")
  • Add StatusLabel for word count (e.g., "Words: 1,234")
  • Add TrackBarItem for zoom control
  • Use Office2016Colorful theme for modern look
  • Read: status-items.md, styling-and-appearance.md
场景: 类似Word的编辑器,展示页码、字数、缩放级别。
  • 添加StatusLabel展示页码(例如 "Page 1 of 5")
  • 添加StatusLabel展示字数(例如 "Words: 1,234")
  • 添加TrackBarItem用于缩放控制
  • 使用Office2016Colorful主题实现现代化外观
  • 参考文档:status-items.mdstyling-and-appearance.md

2. Data Application with Record Count

2. 带记录数的数据应用

Scenario: Database application showing record count and connection status.
  • Left-aligned notification label for connection status
  • Right-aligned label for record count
  • ProgressBar for data loading operations
  • Read: status-items.md
场景: 数据库应用,展示记录数和连接状态。
  • 左对齐的通知标签展示连接状态
  • 右对齐的标签展示记录数
  • 进度条用于数据加载操作
  • 参考文档:status-items.md

3. File Manager with Status Info

3. 带状态信息的文件管理器

Scenario: File manager showing selected items, total size.
  • StatusLabel: "5 items selected"
  • StatusLabel: "Total: 2.5 GB"
  • StatusLabel: "Free space: 150 GB"
  • Read: getting-started.md
场景: 文件管理器,展示选中项、总大小。
  • StatusLabel:"5 items selected"
  • StatusLabel:"Total: 2.5 GB"
  • StatusLabel:"Free space: 150 GB"
  • 参考文档:getting-started.md

4. Application with Background Tasks

4. 带后台任务的应用

Scenario: Show background task progress in status bar.
  • StatusStripLabel: Task description (left-aligned)
  • StatusStripProgressBar: Task progress (left-aligned)
  • Hide progress when task completes
  • Read: status-items.md
场景: 在状态栏展示后台任务进度。
  • StatusStripLabel:任务描述(左对齐)
  • StatusStripProgressBar:任务进度(左对齐)
  • 任务完成后隐藏进度条
  • 参考文档:status-items.md

5. Branded Application Status Bar

5. 品牌化应用状态栏

Scenario: Custom color theme matching brand identity.
  • Set OfficeColorScheme to Managed
  • Apply custom color via ApplyManagedColors
  • Match status bar to application theme
  • Read: styling-and-appearance.md
场景: 匹配品牌标识的自定义颜色主题。
  • 将OfficeColorScheme设置为Managed
  • 通过ApplyManagedColors应用自定义颜色
  • 让状态栏匹配应用主题
  • 参考文档:styling-and-appearance.md

6. Ribbon Application Status Bar

6. Ribbon应用状态栏

Scenario: Status bar for RibbonControlAdv application.
  • Dock StatusStripEx to bottom
  • Match VisualStyle to Ribbon theme
  • Add relevant status items (page, zoom, etc.)
  • Read: getting-started.md, styling-and-appearance.md

场景: RibbonControlAdv应用的状态栏。
  • 将StatusStripEx停靠到底部
  • 让VisualStyle匹配Ribbon主题
  • 添加相关的状态项(页码、缩放等)
  • 参考文档:getting-started.mdstyling-and-appearance.md

Best Practices

最佳实践

  1. Item Alignment: Use StatusControl items for right-aligned, Notification items for left-aligned
  2. Theme Consistency: Match StatusStripEx style to application theme (Office2007/2016)
  3. Sizing Grip: Enable for resizable forms, disable for fixed-size forms
  4. Progress Indicators: Show ProgressBar only during operations, hide when complete
  5. Spring Property: Use Spring=true on left items to push right items to the right
  6. Item Count: Keep status bar items minimal (3-6 items) for clarity
  7. Text Updates: Update status text dynamically to reflect application state
  8. Ribbon Compatibility: Add StatusStripEx after Ribbon to ensure proper docking

  1. 项对齐: 右对齐内容使用StatusControl项,左对齐内容使用Notification项
  2. 主题一致性: StatusStripEx的样式要匹配应用主题(Office2007/2016)
  3. 大小调整手柄: 可调整大小的窗体启用该功能,固定大小的窗体禁用
  4. 进度指示器: 仅在操作进行中展示ProgressBar,完成后隐藏
  5. Spring属性: 给左侧项设置Spring=true,将右侧项推到最右侧
  6. 项数量: 保持状态栏项精简(3-6个)以保证清晰性
  7. 文本更新: 动态更新状态文本以反映应用当前状态
  8. Ribbon兼容性: 在Ribbon之后添加StatusStripEx以确保停靠正常

Related Skills

相关技能

  • StatusBarAdv: Alternative status bar control
  • RibbonControlAdv: Ribbon control that works with StatusStripEx
  • ToolStripEx: Enhanced toolbar control

  • StatusBarAdv: 替代的状态栏控件
  • RibbonControlAdv: 可与StatusStripEx配合使用的Ribbon控件
  • ToolStripEx: 增强版的工具栏控件

See Also

更多参考