转换System.Windows.Forms.Keys序列为Char [英] Convert sequence of System.Windows.Forms.Keys to a Char

查看:321
本文介绍了转换System.Windows.Forms.Keys序列为Char的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来转换按键序列重新​​在一个字符的键枚举(即 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 $℃。这是通过<一条done href="http://msdn.microsoft.com/en-us/library/system.windows.input.keyinterop.virtualkeyfromkey.aspx"相对=nofollow> 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.

这篇关于转换System.Windows.Forms.Keys序列为Char的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆