共用方式為


Mouse.MiddleButton 屬性

定義

取得滑鼠中間鍵的目前狀態。

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

屬性值

滑鼠中間鍵的狀態。

範例

下列範例示範如何藉由檢查 的狀態 MiddleButton 是否等於 MouseButtonState 列舉值 Pressed來判斷是否按下中間滑鼠按鈕。 如果按下按鈕,則會呼叫方法,以更新範例中的顯示元素。

if (Mouse.MiddleButton == MouseButtonState.Pressed)
{
    UpdateSampleResults("Middle Button Pressed");
}
If Mouse.MiddleButton = MouseButtonState.Pressed Then
    UpdateSampleResults("Middle Button Pressed")
End If

適用於

另請參閱