Mouse.XButton2 属性

定义

获取第二个扩展按钮的当前状态。

public:
 static property System::Windows::Input::MouseButtonState XButton2 { System::Windows::Input::MouseButtonState get(); };
public static System.Windows.Input.MouseButtonState XButton2 { get; }
static member XButton2 : System.Windows.Input.MouseButtonState
Public Shared ReadOnly Property XButton2 As MouseButtonState

属性值

第二个鼠标扩展按钮的状态。

示例

下面的示例演示如何通过检查 的状态 XButton2 是否等于 MouseButtonState 枚举值 Pressed来确定是否按下了第二个扩展鼠标按钮。 如果按下按钮,将调用方法,该方法更新示例中的显示元素。

if (Mouse.XButton2 == MouseButtonState.Pressed)
{
    UpdateSampleResults("Second Extended Button Pressed");
}
If Mouse.XButton2 = MouseButtonState.Pressed Then
    UpdateSampleResults("Second Extended Button Pressed")
End If

适用于

另请参阅