Redigera

Dela via


StatusBarPanelClickEventArgs Class

Definition

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
Inheritance
StatusBarPanelClickEventArgs

Examples

The following code example demonstrates the use of this type. 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. 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.

To run the example code, paste it into a project that contains an instance of type StatusBar named StatusBar1. 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

Remarks

The PanelClick event occurs when the user clicks a panel on the StatusBar. 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. 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. 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.

Constructors

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

Initializes a new instance of the StatusBarPanelClickEventArgs class.

Properties

Button

Gets which mouse button was pressed.

(Inherited from MouseEventArgs)
Clicks

Gets the number of times the mouse button was pressed and released.

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

Gets the location of the mouse during the generating mouse event.

(Inherited from MouseEventArgs)
StatusBarPanel

Gets the StatusBarPanel to draw.

X

Gets the x-coordinate of the mouse during the generating mouse event.

(Inherited from MouseEventArgs)
Y

Gets the y-coordinate of the mouse during the generating mouse event.

(Inherited from MouseEventArgs)

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to

See also