LinkLabelLinkClickedEventArgs.Button 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會點擊滑鼠按鈕,點擊連結。
public:
property System::Windows::Forms::MouseButtons Button { System::Windows::Forms::MouseButtons get(); };
public System.Windows.Forms.MouseButtons Button { get; }
member this.Button : System.Windows.Forms.MouseButtons
Public ReadOnly Property Button As MouseButtons
屬性值
這是其中一項 MouseButtons 價值。
範例
以下程式碼範例展示了此成員的使用方式。 在這個例子中,事件處理者會回報事件 LinkLabel.LinkClicked 的發生情況。 此報告能幫助您了解事件發生時間,並協助除錯。 若要報告多個事件或頻繁發生的事件,請考慮將MessageBox.Show訊息替換Console.WriteLine為或附加於多行TextBox。
要執行範例程式碼,請將其貼到包含一個 LinkLabel 名為 LinkLabel1的實例的專案中。 然後確保事件處理程式與事件 LinkLabel.LinkClicked 相關聯。
private void LinkLabel1_LinkClicked(Object sender, LinkLabelLinkClickedEventArgs e) {
System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "Button", e.Button );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Link", e.Link );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "LinkClicked Event" );
}
Private Sub LinkLabel1_LinkClicked(sender as Object, e as LinkLabelLinkClickedEventArgs) _
Handles LinkLabel1.LinkClicked
Dim messageBoxVB as New System.Text.StringBuilder()
messageBoxVB.AppendFormat("{0} = {1}", "Button", e.Button)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Link", e.Link)
messageBoxVB.AppendLine()
MessageBox.Show(messageBoxVB.ToString(),"LinkClicked Event")
End Sub