ToolStripStatusLabel 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示 StatusStrip 控件中的一个面板。
public ref class ToolStripStatusLabel : System::Windows::Forms::ToolStripLabel
public ref class ToolStripStatusLabel : System::Windows::Forms::ToolStripLabel, System::Windows::Forms::Automation::IAutomationLiveRegion
[System.Windows.Forms.Design.ToolStripItemDesignerAvailability(System.Windows.Forms.Design.ToolStripItemDesignerAvailability.StatusStrip)]
public class ToolStripStatusLabel : System.Windows.Forms.ToolStripLabel
[System.Windows.Forms.Design.ToolStripItemDesignerAvailability(System.Windows.Forms.Design.ToolStripItemDesignerAvailability.StatusStrip)]
public class ToolStripStatusLabel : System.Windows.Forms.ToolStripLabel, System.Windows.Forms.Automation.IAutomationLiveRegion
[<System.Windows.Forms.Design.ToolStripItemDesignerAvailability(System.Windows.Forms.Design.ToolStripItemDesignerAvailability.StatusStrip)>]
type ToolStripStatusLabel = class
inherit ToolStripLabel
[<System.Windows.Forms.Design.ToolStripItemDesignerAvailability(System.Windows.Forms.Design.ToolStripItemDesignerAvailability.StatusStrip)>]
type ToolStripStatusLabel = class
inherit ToolStripLabel
interface IAutomationLiveRegion
Public Class ToolStripStatusLabel
Inherits ToolStripLabel
Public Class ToolStripStatusLabel
Inherits ToolStripLabel
Implements IAutomationLiveRegion
- 继承
- 继承
-
ToolStripStatusLabel
- 属性
- 实现
示例
下面的代码示例演示 ToolStripStatusLabel 了具有各种常见属性集的 。
using System;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication5
{
public class Form1 : Form
{
private StatusStrip statusStrip1;
private ToolStripStatusLabel toolStripStatusLabel1;
public Form1()
{
InitializeComponent();
}
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Form1());
}
private void InitializeComponent()
{
statusStrip1 = new System.Windows.Forms.StatusStrip();
toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
statusStrip1.SuspendLayout();
SuspendLayout();
//
// statusStrip1
//
statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
toolStripStatusLabel1});
statusStrip1.Location = new System.Drawing.Point(0, 248);
statusStrip1.Name = "statusStrip1";
statusStrip1.Size = new System.Drawing.Size(292, 25);
statusStrip1.TabIndex = 0;
statusStrip1.Text = "statusStrip1";
//
//
toolStripStatusLabel1.BorderSides = ((System.Windows.Forms.ToolStripStatusLabelBorderSides)((((System.Windows.Forms.ToolStripStatusLabelBorderSides.Left | System.Windows.Forms.ToolStripStatusLabelBorderSides.Top)
| System.Windows.Forms.ToolStripStatusLabelBorderSides.Right)
| System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom)));
toolStripStatusLabel1.BorderStyle = System.Windows.Forms.Border3DStyle.Raised;
toolStripStatusLabel1.IsLink = true;
toolStripStatusLabel1.Name = "toolStripStatusLabel1";
toolStripStatusLabel1.Size = new System.Drawing.Size(246, 20);
toolStripStatusLabel1.Spring = true;
toolStripStatusLabel1.Text = "toolStripStatusLabel1";
toolStripStatusLabel1.Alignment = ToolStripItemAlignment.Left;
// Form1
//
ClientSize = new System.Drawing.Size(292, 273);
Controls.Add(statusStrip1);
Name = "Form1";
statusStrip1.ResumeLayout(false);
statusStrip1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
}
}
Imports System.Text
Imports System.Windows.Forms
Public Class Form1
Inherits Form
Private statusStrip1 As StatusStrip
Private toolStripStatusLabel1 As ToolStripStatusLabel
Public Sub New()
InitializeComponent()
End Sub
<STAThread()> _
Shared Sub Main()
Application.EnableVisualStyles()
Application.Run(New Form1())
End Sub
Private Sub InitializeComponent()
statusStrip1 = New System.Windows.Forms.StatusStrip()
toolStripStatusLabel1 = New System.Windows.Forms.ToolStripStatusLabel()
statusStrip1.SuspendLayout()
SuspendLayout()
'
' statusStrip1
'
statusStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {toolStripStatusLabel1})
statusStrip1.Location = New System.Drawing.Point(0, 248)
statusStrip1.Name = "statusStrip1"
statusStrip1.Size = New System.Drawing.Size(292, 25)
statusStrip1.TabIndex = 0
statusStrip1.Text = "statusStrip1"
'
'
toolStripStatusLabel1.BorderSides = CType(System.Windows.Forms.ToolStripStatusLabelBorderSides.Left Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Top Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Right Or System.Windows.Forms.ToolStripStatusLabelBorderSides.Bottom, System.Windows.Forms.ToolStripStatusLabelBorderSides)
toolStripStatusLabel1.BorderStyle = System.Windows.Forms.Border3DStyle.Raised
toolStripStatusLabel1.IsLink = True
toolStripStatusLabel1.Name = "toolStripStatusLabel1"
toolStripStatusLabel1.Size = New System.Drawing.Size(246, 20)
toolStripStatusLabel1.Spring = True
toolStripStatusLabel1.Text = "toolStripStatusLabel1"
toolStripStatusLabel1.Alignment = ToolStripItemAlignment.Left
' Form1
'
ClientSize = New System.Drawing.Size(292, 273)
Controls.Add(statusStrip1)
Name = "Form1"
statusStrip1.ResumeLayout(False)
statusStrip1.PerformLayout()
ResumeLayout(False)
PerformLayout()
End Sub
End Class
注解
ToolStripStatusLabel 是专为在 StatusStrip 中使用而设计的 ToolStripLabel 版本。 特殊功能包括 BorderStyle、BorderSides 和 Spring。
可以 ToolStripStatusLabel 包含反映应用程序状态的文本或图标。 ToolStripItemCollection使用 类查找、添加或删除ToolStripStatusLabel对象。
ToolStripStatusLabel 替换并扩展 StatusBarPanel 控件,该控件在 .NET 5 中已删除。
构造函数
ToolStripStatusLabel() |
初始化 ToolStripStatusLabel 类的新实例。 |
ToolStripStatusLabel(Image) |
初始化 ToolStripStatusLabel 类的新实例,使之显示指定的图像。 |
ToolStripStatusLabel(String) |
初始化 ToolStripStatusLabel 类的新实例,使之显示指定的文本。 |
ToolStripStatusLabel(String, Image) |
初始化 ToolStripStatusLabel 类的新实例,使之显示指定的图像和文本。 |
ToolStripStatusLabel(String, Image, EventHandler) |
初始化 ToolStripStatusLabel 类的新实例,该类显示指定的图像和文本并在用户单击 ToolStripStatusLabel 时执行指定的操作。 |
ToolStripStatusLabel(String, Image, EventHandler, String) |
用指定名称初始化 ToolStripStatusLabel 类的新实例,该类显示指定的图像和文本并在用户单击 ToolStripStatusLabel 时执行指定的操作。 |
属性
方法
事件
显式接口实现
IDropTarget.OnDragDrop(DragEventArgs) |
引发 DragDrop 事件。 (继承自 ToolStripItem) |
IDropTarget.OnDragEnter(DragEventArgs) |
引发 DragEnter 事件。 (继承自 ToolStripItem) |
IDropTarget.OnDragLeave(EventArgs) |
引发 DragLeave 事件。 (继承自 ToolStripItem) |
IDropTarget.OnDragOver(DragEventArgs) |
引发 |