Created
November 30, 2018 14:20
-
-
Save erkantaylan/f6ec0bd0d5a58dd72836ba9a058251a2 to your computer and use it in GitHub Desktop.
converting Keys to Key and Key To Keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class KeyExtensions | |
{ | |
public static System.Windows.Input.Key ToKey(this System.Windows.Forms.Keys keys) | |
{ | |
return System.Windows.Input.KeyInterop.KeyFromVirtualKey((int) keys); | |
} | |
public static System.Windows.Forms.Keys ToKeys(this System.Windows.Input.Key key) | |
{ | |
return (System.Windows.Forms.Keys) System.Windows.Input.KeyInterop.VirtualKeyFromKey(key); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment