共用方式為


KeyEventArgs.IsUp 屬性

定義

會得到一個值,表示事件所參考的鍵是否處於 up 狀態。

public:
 property bool IsUp { bool get(); };
public bool IsUp { get; }
member this.IsUp : bool
Public ReadOnly Property IsUp As Boolean

屬性值

true如果鑰匙是上方;否則,。 false 沒有預設值。

範例

以下範例透過取得屬性的IsUp狀態來檢查與 實KeyEventArgs例相關的金鑰是否為 UP。

// e is an instance of KeyEventArgs.
// btnIsUp is a Button.
if (e.IsUp)
{
    btnIsUp.Background = Brushes.Red;
}
' e is an instance of KeyEventArgs.
' btnIsUp is a Button.
If e.IsUp Then
    btnIsUp.Background = Brushes.Red

備註

Keyboard 類別也會提供鍵盤按鍵狀態的資訊。 例如,該 IsKeyUp 方法會回傳指定的某個是否正在運作。

適用於

另請參閱