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

適用於

另請參閱