MouseEventArgs.LeftButton 属性

定义

获取鼠标左键的当前状态。

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

属性值

鼠标左键的当前状态,为 PressedReleased。 无默认值。

示例

如果 属性的状态 LeftButtonPressed,则以下示例将打印一条消息。

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

注解

Mouse 提供用于确定鼠标状态的其他属性和方法。

适用于