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

适用于

另请参阅