Skip to content

IKeyboardState Interface

Holds the state of keystrokes by a keyboard.

C#
public interface IKeyboardState

Gets the current state of the Caps Lock key.

C#
bool CapsLock { get; }

Gets the current state of the Num Lock key.

C#
bool NumLock { get; }

Gets whether given key is currently being pressed.

C#
bool IsKeyDown(Keys key)

key Keys
The key to query.

bool
true if the key is pressed; false otherwise.

Gets whether given key is currently being not pressed.

C#
bool IsKeyUp(Keys key)

key Keys
The key to query.

bool
true if the key is not pressed; false otherwise.

Returns an array of values holding keys that are currently being pressed.

C#
Keys[] GetPressedKeys()

Keys[]
The keys that are currently being pressed.

If applicable to the host implementation, refreshes the keyboard state.

C#
void Refresh()