Jeremy
Jeremy

Reputation: 46440

How to convert from Virtual Key codes to System.Windows.Forms.Keys

If I intercept a key press using win32 calls, I now have a key code. Is there a way to convert that to a System.Windows.Forms.Keys value?

Upvotes: 11

Views: 19518

Answers (2)

xcud
xcud

Reputation: 14732

Use KeyInterop.KeyFromVirtualKey().

Upvotes: 23

Adam Larsen
Adam Larsen

Reputation: 1121

The integer values for System.Windows.Forms.Keys enum match that of the Win32 calls.

Keys keyData = (Keys)rawWin32KeyCode;

Upvotes: 10

Related Questions