StatusBarPanelClickEventArgs 类

定义

PanelClick 事件提供数据。Provides data for the PanelClick event.

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
继承
StatusBarPanelClickEventArgs

示例

下面的代码示例演示如何使用此类型。The following code example demonstrates the use of this type. 在此示例中, 事件处理程序报告PanelClick事件的发生。In the example, an event handler reports on the occurrence of the PanelClick event. 此报表可帮助你了解何时发生事件, 并可帮助你进行调试。This report helps you to learn when the event occurs and can assist you in debugging. 若要报告多个事件或频繁发生的事件, 请考虑ShowConsole.WriteLine消息替换为多行或将TextBox其追加到多行。To report on multiple events or on events that occur frequently, consider replacing Show with Console.WriteLine or appending the message to a multiline TextBox.

若要运行示例代码, 请将其粘贴到包含名为StatusBar StatusBar1的类型的实例的项目中。To run the example code, paste it into a project that contains an instance of type StatusBar named StatusBar1. 然后, 确保事件处理程序与PanelClick事件相关联。Then ensure that the event handler is associated with the PanelClick event.

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上的面板时发生此事件。The PanelClick event occurs when the user clicks a panel on the StatusBar. 指定单击的、按下的鼠标按钮、按下的次数以及在单击时StatusBarPanel鼠标单击的坐标。 StatusBarPanel StatusBarPanelClickEventArgsA StatusBarPanelClickEventArgs specifies which StatusBarPanel was clicked, the mouse button that was pressed, how many times it was pressed, and the coordinates of the mouse click at the time the StatusBarPanel was clicked. 您可以在事件处理程序PanelClick中使用此类提供的数据来执行与所单击的相关的StatusBarPanel任务。You can use the data provided by this class in an event handler for the PanelClick event to perform tasks related to the StatusBarPanel being clicked. 例如, 如果StatusBarPanel使用显示时间, 则可以PanelClick为事件创建事件处理程序, 并使用此类提供的数据显示一个对话框, 该对话框允许您修改系统上的日期和时间。For example, if a StatusBarPanel is used to display the time, you could create an event handler for the PanelClick event and use data provided by this class to display a dialog box that allows you to modify the date and time on the system.

构造函数

StatusBarPanelClickEventArgs(StatusBarPanel, MouseButtons, Int32, Int32, Int32)

初始化 StatusBarPanelClickEventArgs 类的新实例。Initializes a new instance of the StatusBarPanelClickEventArgs class.

属性

Button

获取曾按下的是哪个鼠标按钮。Gets which mouse button was pressed.

(继承自 MouseEventArgs)
Clicks

获取按下并释放鼠标按钮的次数。Gets the number of times the mouse button was pressed and released.

(继承自 MouseEventArgs)
Delta

获取鼠标轮已转动的制动器数的有符号计数乘以 WHEEL_DELTA 常数。Gets a signed count of the number of detents the mouse wheel has rotated, multiplied by the WHEEL_DELTA constant. 制动器是鼠标轮的一个凹口。A detent is one notch of the mouse wheel.

(继承自 MouseEventArgs)
Location

获取鼠标在产生鼠标事件时的位置。Gets the location of the mouse during the generating mouse event.

(继承自 MouseEventArgs)
StatusBarPanel

获取要绘制的 StatusBarPanelGets the StatusBarPanel to draw.

X

获取鼠标在产生鼠标事件时的 x 坐标。Gets the x-coordinate of the mouse during the generating mouse event.

(继承自 MouseEventArgs)
Y

获取鼠标在产生鼠标事件时的 y 坐标。Gets the y-coordinate of the mouse during the generating mouse event.

(继承自 MouseEventArgs)

方法

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetHashCode()

作为默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅