KeyEventArgs.IsDown 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會得到一個值,表示事件所參考的金鑰是否處於關閉狀態。
public:
property bool IsDown { bool get(); };
public bool IsDown { get; }
member this.IsDown : bool
Public ReadOnly Property IsDown As Boolean
屬性值
true如果鑰匙在下;否則,。 false
範例
以下範例透過取得屬性的狀態IsDown來檢查與 實KeyEventArgs例相關的金鑰是否為 down。
// e is an instance of KeyEventArgs.
// btnIsDown is a Button.
if (e.IsDown)
{
btnIsDown.Background = Brushes.Red;
}
' e is an instance of KeyEventArgs.
' btnIsDown is a Button.
If e.IsDown Then
btnIsDown.Background = Brushes.Red
備註
該 Keyboard 類別也會提供鍵盤按鍵狀態的資訊。 例如,該 IsKeyDown 方法會回傳指定的鍵是否被關閉。