Bagikan melalui


MouseEventArgs.LeftButton Properti

Definisi

Mendapatkan status tombol kiri mouse saat ini.

public:
 property System::Windows::Input::MouseButtonState LeftButton { System::Windows::Input::MouseButtonState get(); };
public System.Windows.Input.MouseButtonState LeftButton { get; }
member this.LeftButton : System.Windows.Input.MouseButtonState
Public ReadOnly Property LeftButton As MouseButtonState

Nilai Properti

Status tombol mouse kiri saat ini, yaitu Pressed atau Released. Tidak ada nilai default.

Contoh

Contoh berikut mencetak pesan jika status LeftButton properti adalah Pressed.

if (e.LeftButton == MouseButtonState.Pressed)
{
    MessageBox.Show("The Left Mouse Button is pressed");
}
If e.LeftButton = MouseButtonState.Pressed Then
    MessageBox.Show("The Left Mouse Button is pressed")
End If

Keterangan

Kelas Mouse ini menyediakan properti dan metode tambahan untuk menentukan status mouse.

Berlaku untuk