C# 如何从虚拟键代码转换为 System.Windows.Forms.Keys
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/554015/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 07:56:49 来源:igfitidea点击:
How to convert from Virtual Key codes to System.Windows.Forms.Keys
提问by Jeremy
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?
如果我使用 win32 调用拦截按键,我现在有一个键码。有没有办法将其转换为 System.Windows.Forms.Keys 值?
采纳答案by Adam L
The integer values for System.Windows.Forms.Keys enum match that of the Win32 calls.
System.Windows.Forms.Keys 枚举的整数值匹配 Win32 调用的整数值。
Keys keyData = (Keys)rawWin32KeyCode;