StatusBarPanelClickEventArgs StatusBarPanelClickEventArgs StatusBarPanelClickEventArgs StatusBarPanelClickEventArgs Class

定义

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

示例

下面的代码示例演示如何使用此类型。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或将消息附加到多行TextBoxTo 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名为StatusBar1To 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事件发生时,用户单击一个面板StatusBarThe PanelClick event occurs when the user clicks a panel on the StatusBar. 一个StatusBarPanelClickEventArgs指定哪些StatusBarPanel被单击的鼠标按钮曾按下、 多少次按下,以及时鼠标单击的坐标StatusBarPanel被单击。A 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(StatusBarPanel, MouseButtons, Int32, Int32, Int32) StatusBarPanelClickEventArgs(StatusBarPanel, MouseButtons, Int32, Int32, Int32) StatusBarPanelClickEventArgs(StatusBarPanel, MouseButtons, Int32, Int32, Int32)

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

属性

Button Button Button Button

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

(Inherited from MouseEventArgs)
Clicks Clicks Clicks Clicks

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

(Inherited from MouseEventArgs)
Delta Delta Delta 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.

(Inherited from MouseEventArgs)
Location Location Location Location

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

(Inherited from MouseEventArgs)
StatusBarPanel StatusBarPanel StatusBarPanel StatusBarPanel

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

X X X X

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

(Inherited from MouseEventArgs)
Y Y Y Y

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

(Inherited from MouseEventArgs)

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetType() GetType() GetType() GetType()

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

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
ToString() ToString() ToString() ToString()

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

(Inherited from Object)

适用于

另请参阅