StatusBarPanelClickEventArgs 类
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为 PanelClick 事件提供数据。
public ref class StatusBarPanelClickEventArgs : System::Windows::Forms::MouseEventArgs
public class StatusBarPanelClickEventArgs : System.Windows.Forms.MouseEventArgs
type StatusBarPanelClickEventArgs = class
inherit MouseEventArgs
Public Class StatusBarPanelClickEventArgs
Inherits MouseEventArgs
- 继承
下面的代码示例演示了此类型的用法。 在此示例中,事件处理程序报告事件的发生情况 PanelClick 。 此报表可帮助你了解事件发生的时间,并可以帮助你进行调试。 若要报告多个事件或频繁发生的事件,请考虑将 Show 替换为 Console.WriteLine 或将消息追加到多行 TextBox。
若要运行示例代码,请将其粘贴到包含名为 StatusBar1
的 类型的StatusBar实例的项目中。 然后,确保事件处理程序与 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 任务。 例如,如果使用 StatusBarPanel 来显示时间,则可以为 PanelClick 事件创建事件处理程序,并使用此类提供的数据来显示一个对话框,该对话框允许您修改系统上的日期和时间。
Status |
初始化 StatusBarPanelClickEventArgs 类的新实例。 |
Button |
获取曾按下的是哪个鼠标按钮。 (继承自 MouseEventArgs) |
Clicks |
获取按下并释放鼠标按钮的次数。 (继承自 MouseEventArgs) |
Delta |
获取鼠标轮已转动的制动器数的有符号计数乘以 WHEEL_DELTA 常数。 制动器是鼠标轮的一个凹口。 (继承自 MouseEventArgs) |
Location |
获取鼠标在产生鼠标事件时的位置。 (继承自 MouseEventArgs) |
Status |
获取要绘制的 StatusBarPanel。 |
X |
获取鼠标在产生鼠标事件时的 x 坐标。 (继承自 MouseEventArgs) |
Y |
获取鼠标在产生鼠标事件时的 y 坐标。 (继承自 MouseEventArgs) |
Equals(Object) |
确定指定对象是否等于当前对象。 (继承自 Object) |
Get |
作为默认哈希函数。 (继承自 Object) |
Get |
获取当前实例的 Type。 (继承自 Object) |
Memberwise |
创建当前 Object 的浅表副本。 (继承自 Object) |
To |
返回表示当前对象的字符串。 (继承自 Object) |
产品 | 版本 |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1 |