通过


MouseEventArgs.XButton1 属性

定义

获取第一个扩展鼠标按钮的当前状态。

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

属性值

第一个扩展鼠标按钮的当前状态,可以是 PressedReleased。 没有默认值。

示例

如果属性的状态 XButton1Pressed,以下示例将输出消息。

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

注解

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

适用于