通过


KeyEventArgs.IsUp 属性

定义

获取一个值,该值指示事件引用的键是否处于启动状态。

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

属性值

true 如果键已启动,则为否则,为 false. 没有默认值。

示例

以下示例通过获取属性的状态IsUp来检查与实例KeyEventArgs关联的键是否已启动。

// 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 返回指定的值是否已启动。

适用于

另请参阅