StatusBarPanelClickEventArgs 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
警告
StatusBar is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use StatusStrip instead.
提供 PanelClick 事件的資料。
public ref class StatusBarPanelClickEventArgs : System::Windows::Forms::MouseEventArgs
public class StatusBarPanelClickEventArgs : System.Windows.Forms.MouseEventArgs
[System.ComponentModel.Browsable(false)]
[System.Obsolete("`StatusBar` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `StatusStrip` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")]
public class StatusBarPanelClickEventArgs : System.Windows.Forms.MouseEventArgs
type StatusBarPanelClickEventArgs = class
inherit MouseEventArgs
[<System.ComponentModel.Browsable(false)>]
[<System.Obsolete("`StatusBar` is provided for binary compatibility with .NET Framework and is not intended to be used directly from your code. Use `StatusStrip` instead.", false, DiagnosticId="WFDEV006", UrlFormat="https://aka.ms/winforms-warnings/{0}")>]
type StatusBarPanelClickEventArgs = class
inherit MouseEventArgs
Public Class StatusBarPanelClickEventArgs
Inherits MouseEventArgs
- 繼承
- 屬性
範例
下列程式代碼範例示範此類型的用法。 在這個例子中,事件處理者會回報事件 PanelClick 的發生情況。 此報告能幫助您了解事件發生時間,並協助除錯。 若要報告多個事件或頻繁發生的事件,請考慮將Show訊息替換Console.WriteLine為或附加於多行TextBox。
要執行範例程式碼,請將其貼到包含一個 StatusBar 名為 StatusBar1的實例的專案中。 然後確保事件處理程式與事件 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. A StatusBarPanelClickEventArgs 指定了點擊的對象 StatusBarPanel 、被按下的滑鼠按鈕、按了幾次,以及點擊時滑鼠 StatusBarPanel 點擊的座標。 你可以利用這個類別提供的資料,在事件處理程序 PanelClick 中執行與 StatusBarPanel 被點擊事件相關的任務。 例如,如果使用 a StatusBarPanel 來顯示時間,你可以為該事件建立一個事件處理程序 PanelClick ,並利用這個類別提供的資料顯示一個對話框,讓你能修改系統上的日期和時間。
建構函式
| 名稱 | Description |
|---|---|
| StatusBarPanelClickEventArgs(StatusBarPanel, MouseButtons, Int32, Int32, Int32) |
已淘汰.
初始化 StatusBarPanelClickEventArgs 類別的新執行個體。 |
屬性
| 名稱 | Description |
|---|---|
| Button |
已淘汰.
會知道是哪個滑鼠按鍵被按下的。 (繼承來源 MouseEventArgs) |
| Clicks |
已淘汰.
會顯示滑鼠按鍵被按下和放開的次數。 (繼承來源 MouseEventArgs) |
| Delta |
已淘汰.
會得到滑鼠滾輪旋轉的卡位數,並乘以WHEEL_DELTA常數。 卡位是滑鼠滾輪的一個刻度。 (繼承來源 MouseEventArgs) |
| Location |
已淘汰.
取得生成事件期間滑鼠的位置。 (繼承來源 MouseEventArgs) |
| StatusBarPanel |
已淘汰.
他會畫 StatusBarPanel 畫。 |
| X |
已淘汰.
在生成滑鼠事件期間取得滑鼠的 x 座標。 (繼承來源 MouseEventArgs) |
| Y |
已淘汰.
在生成滑鼠事件期間取得滑鼠的 y 座標。 (繼承來源 MouseEventArgs) |
方法
| 名稱 | Description |
|---|---|
| Equals(Object) |
已淘汰.
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
| GetHashCode() |
已淘汰.
做為預設哈希函式。 (繼承來源 Object) |
| GetType() |
已淘汰.
取得目前實例的 Type。 (繼承來源 Object) |
| MemberwiseClone() |
已淘汰.
建立目前 Object的淺層複本。 (繼承來源 Object) |
| ToString() |
已淘汰.
傳回表示目前 物件的字串。 (繼承來源 Object) |