StatusBarPanelClickEventArgs 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
注意
StatusBar is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use StatusStrip instead.
提供事件的数据 PanelClick 。
public ref class StatusBarPanelClickEventArgs : System::Windows::Forms::MouseEventArgs
public class StatusBarPanelClickEventArgs : System.Windows.Forms.MouseEventArgs
[System.ComponentModel.Browsable(false)]
[System.Obsolete("`StatusBar` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `StatusStrip` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")]
public class StatusBarPanelClickEventArgs : System.Windows.Forms.MouseEventArgs
type StatusBarPanelClickEventArgs = class
inherit MouseEventArgs
[<System.ComponentModel.Browsable(false)>]
[<System.Obsolete("`StatusBar` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `StatusStrip` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")>]
type StatusBarPanelClickEventArgs = class
inherit MouseEventArgs
Public Class StatusBarPanelClickEventArgs
Inherits MouseEventArgs
- 继承
- 特性
示例
下面的代码示例演示了此类型的用法。 在此示例中,事件处理程序报告事件的发生情况 PanelClick 。 此报告可帮助你了解事件发生的时间,并可以帮助你进行调试。 若要报告多个事件或频繁发生的事件,请考虑替换ShowConsole.WriteLine或将消息追加到多行TextBox。
若要运行示例代码,请将其粘贴到包含命名StatusBar类型的StatusBar1实例的项目中。 然后,确保事件处理程序与 PanelClick 事件相关联。
private void StatusBar1_PanelClick(Object sender, StatusBarPanelClickEventArgs e) {
System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "StatusBarPanel", e.StatusBarPanel );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Button", e.Button );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Clicks", e.Clicks );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "X", e.X );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Y", e.Y );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Delta", e.Delta );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Location", e.Location );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "PanelClick Event" );
}
Private Sub StatusBar1_PanelClick(sender as Object, e as StatusBarPanelClickEventArgs) _
Handles StatusBar1.PanelClick
Dim messageBoxVB as New System.Text.StringBuilder()
messageBoxVB.AppendFormat("{0} = {1}", "StatusBarPanel", e.StatusBarPanel)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Button", e.Button)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Clicks", e.Clicks)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "X", e.X)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Y", e.Y)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Delta", e.Delta)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Location", e.Location)
messageBoxVB.AppendLine()
MessageBox.Show(messageBoxVB.ToString(),"PanelClick Event")
End Sub
注解
当用户 PanelClick 单击面板时 StatusBar发生该事件。 一个 StatusBarPanelClickEventArgs 指定单击的内容 StatusBarPanel 、按下的鼠标按钮、按下的次数,以及单击时 StatusBarPanel 鼠标单击的坐标。 可以在事件处理程序中使用此类提供的数据,以便事件 PanelClick 执行与被单击相关的 StatusBarPanel 任务。 例如,如果使用 a StatusBarPanel 来显示时间,则可以为 PanelClick 事件创建事件处理程序,并使用此类提供的数据来显示一个对话框,该对话框允许您修改系统上的日期和时间。
构造函数
| 名称 | 说明 |
|---|---|
| StatusBarPanelClickEventArgs(StatusBarPanel, MouseButtons, Int32, Int32, Int32) |
已过时.
初始化 StatusBarPanelClickEventArgs 类的新实例。 |
属性
| 名称 | 说明 |
|---|---|
| Button |
已过时.
获取按下了哪个鼠标按钮。 (继承自 MouseEventArgs) |
| Clicks |
已过时.
获取按下和释放鼠标按钮的次数。 (继承自 MouseEventArgs) |
| Delta |
已过时.
获取鼠标滚轮旋转的有符号计数,乘以WHEEL_DELTA常量。 缩进是鼠标滚轮的一个角。 (继承自 MouseEventArgs) |
| Location |
已过时.
获取在生成鼠标事件期间鼠标的位置。 (继承自 MouseEventArgs) |
| StatusBarPanel |
已过时.
获取要绘制的 StatusBarPanel 。 |
| X |
已过时.
获取在生成鼠标事件期间鼠标的 x 坐标。 (继承自 MouseEventArgs) |
| Y |
已过时.
获取在生成鼠标事件期间鼠标的 y 坐标。 (继承自 MouseEventArgs) |
方法
| 名称 | 说明 |
|---|---|
| Equals(Object) |
已过时.
确定指定的对象是否等于当前对象。 (继承自 Object) |
| GetHashCode() |
已过时.
用作默认哈希函数。 (继承自 Object) |
| GetType() |
已过时.
获取当前实例的 Type。 (继承自 Object) |
| MemberwiseClone() |
已过时.
创建当前 Object的浅表副本。 (继承自 Object) |
| ToString() |
已过时.
返回一个表示当前对象的字符串。 (继承自 Object) |