Mouse.LeftButton 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取鼠标左侧按钮的状态。
public:
static property System::Windows::Input::MouseButtonState LeftButton { System::Windows::Input::MouseButtonState get(); };
public static System.Windows.Input.MouseButtonState LeftButton { get; }
static member LeftButton : System.Windows.Input.MouseButtonState
Public Shared ReadOnly Property LeftButton As MouseButtonState
属性值
鼠标左键的状态。
示例
下面的示例演示如何通过检查鼠标左键的状态是否 LeftButton 等于 MouseButtonState 枚举值 Pressed来确定是否按下鼠标左键。 如果按下按钮,将调用更新示例中显示元素的方法。
if (Mouse.LeftButton == MouseButtonState.Pressed)
{
UpdateSampleResults("Left Button Pressed");
}
If Mouse.LeftButton = MouseButtonState.Pressed Then
UpdateSampleResults("Left Button Pressed")
End If