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