C# 将 Keycode 传输到 Keychar
我知道这个问题是由使用“Keydown-Keycode”而不是“Keypress-Keychar”引起的,但是如何让我的 Keydown 使用 Keychar 呢?有什么想法。 我使用全局键盘钩子,该钩子似乎只使用 KeyUp 和 KeyDown。如果你知道如何获得一个全局钩子来使用 KeyPress,那就太棒了
private string b = string.Empty;
public void gkhr_KeyDown(object sender, KeyEventArgs e)
{
s += (char)e.KeyCode;
b = s; // i made b = s because otherwise it would add two values together
b = b.ToLower(); // Was able to use A-Z in lowercase here
s = string.Empty; // cheeky little hack
MessageBox.Show(b);
当我单击键盘“时,”它显示“3/4”。 另一个例子是“F1”打印“q”
链接 [1]: https://i.sstatic.net/LiQ9e.png
I know this issue is caused by using "Keydown-Keycode" and not "Keypress-Keychar" but how would I get my Keydown to use Keychar instead? Any thoughts.
Im using a global keyboard hook and the hook only seems to use KeyUp and KeyDown. If you know how I can get a global hook to use KeyPress that would be awesome
private string b = string.Empty;
public void gkhr_KeyDown(object sender, KeyEventArgs e)
{
s += (char)e.KeyCode;
b = s; // i made b = s because otherwise it would add two values together
b = b.ToLower(); // Was able to use A-Z in lowercase here
s = string.Empty; // cheeky little hack
MessageBox.Show(b);
When I click on keyboard "," it displays "3/4".
Another example being "F1" prints "q"
Link
[1]: https://i.sstatic.net/LiQ9e.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论