Share via


StatusBarPanelClickEventArgs.StatusBarPanel 屬性

定義

取得要繪製的 StatusBarPanel

public:
 property System::Windows::Forms::StatusBarPanel ^ StatusBarPanel { System::Windows::Forms::StatusBarPanel ^ get(); };
public System.Windows.Forms.StatusBarPanel StatusBarPanel { get; }
member this.StatusBarPanel : System.Windows.Forms.StatusBarPanel
Public ReadOnly Property StatusBarPanel As StatusBarPanel

屬性值

要繪製的 StatusBarPanel

範例

下列程式碼範例示範此成員的使用。 在此範例中,事件處理常式會報告事件發生次數 StatusBar.PanelClick 。 此報告可協助您瞭解事件發生的時間,並可協助您進行偵錯。 若要報告多個事件或經常發生的事件,請考慮將 取代 MessageBox.ShowConsole.WriteLine 為 或將訊息附加至多行 TextBox

若要執行範例程式碼,請將它貼到包含名為 StatusBar1 之型 StatusBar 別實例的專案。 然後,確定事件處理常式與事件相關聯 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

備註

屬性 StatusBarPanel 可讓您取得 StatusBarPanel 已按一下的 。 您可以在控制項事件的 StatusBar 事件處理常式內使用此專案 PanelClick 來執行工作,例如按一下控制項內的 StatusBarStatusBarPanel 顯示自訂對話方塊。

適用於

另請參閱