Share via


KeyEventArgs.IsRepeat 属性

定义

获取指示事件引用的键盘键是否为重复键的值。

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

属性值

如果该键是重复的,则为 true;否则为 false。 无默认值。

示例

以下示例通过获取 属性的状态来检查与 实例 KeyEventArgs 关联的键是否为重复键 IsRepeat

// e is an instance of KeyEventArgs.
// btnIsRepeat is a Button.
if (e.IsRepeat)
{
    btnIsRepeat.Background = Brushes.AliceBlue;
}
' e is an instance of KeyEventArgs.
' btnIsRepeat is a Button.
If e.IsRepeat Then
    btnIsRepeat.Background = Brushes.AliceBlue
End If

适用于

另请参阅