MouseEventArgs.Button Özellik
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Hangi fare düğmesine basıldığını alır.
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
Değerlerden MouseButtons biri.
Aşağıdaki kod örneği, TextBox bir denetimdeki MouseDown olayı işler, böylece sağ fare düğmesine tıklanması denetimdeki tüm metni seçer. Bu örnek, adlı textBox1
bir denetim içeren bir TextBox formunuz olmasını gerektirir.
private void Form1_Load(object sender, EventArgs e)
{
// This line suppresses the default context menu for the TextBox control.
textBox1.ContextMenu = new ContextMenu();
textBox1.MouseDown += new MouseEventHandler(textBox1_MouseDown);
}
void textBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
textBox1.Select(0, textBox1.Text.Length);
}
}
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.ContextMenu = New ContextMenu()
End Sub
Private Sub TextBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown
If (e.Button = Windows.Forms.MouseButtons.Right) Then
TextBox1.Select(0, TextBox1.Text.Length)
End If
End Sub
Ürün | Sürümler |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET geri bildirimi
.NET, açık kaynak bir projedir. Geri bildirim sağlamak için bir bağlantı seçin: