转换System.Windows.Forms.Keys序列为Char序列、Windows、System、Forms

由网友(魏先森的魏未婚妻)分享简介:有没有一种方法来转换按键序列重新​​在一个字符的键枚举(即 System.Windows.Forms.Keys )psented $ P $。例如: Keys.Oem4 然后 Keys.A 产生的炭 A 。它必须在WinAPI的存在的地方,因为Windows不会对我来说,当我$在文本,盒P $ PSS键......我只...

有没有一种方法来转换按键序列重新​​在一个字符的键枚举(即 System.Windows.Forms.Keys )psented $ P $。例如: Keys.Oem4 然后 Keys.A 产生的炭 A 。它必须在WinAPI的存在的地方,因为Windows不会对我来说,当我$在文本,盒P $ PSS键......我只是不知道在哪里。请帮忙!谢谢。

Is there a way to convert a sequence of keystrokes represented by the Keys enum (i.e. System.Windows.Forms.Keys) in a Char. For example: Keys.Oem4 and then Keys.A yields the char á. It must exist somewhere in the WinAPI, because Windows does that for me, when I press keys inside a text-box... I just don't know where. Please help! thanks.

编辑:

我要的是记录用户输入的按键,后来转换键的字符序列,而无需用户不必再输入所有的一切,像宏。

What I want is to record the user input keys, and later translate the sequence of keys to characters, without the user having to type everything again, something like a macro.

推荐答案

最直接的方式做到这一点是首先修道院值转换成虚拟按键$ C $℃。这是通过 KeyInterop.VirtualKeyFromKey 。到然后,您可以的PInvoke进入 MapVirtualKey 功能转换键成炭。

The most straight forward way to do this is to first convent the Key value into a Virtual Key code. This is done via KeyInterop.VirtualKeyFromKey. You can then PInvoke into the MapVirtualKey function to convert the key into a char.

阅读全文

相关推荐

最新文章