嗨,我在屏幕键盘上制作。它很简单......我是C#编程的新手......我不知道如何编写箭头代码? :-( [英] Hi, I am making on the Screen Keyboard . Its just simple ... I am new in C# Programming... I don't know how to code Arrows ? :-(
本文介绍了嗨,我在屏幕键盘上制作。它很简单......我是C#编程的新手......我不知道如何编写箭头代码? :-(的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请分享我的箭头键COED,点击菜单键和Windows按键
Please Share me COde for Arrow Keys, RIght click menu Key and Windows Button Key
推荐答案
不,这并不像你想象的那么简单。有一些问题,其中之一:屏幕键盘可以抓住键盘焦点,这应该留在数据输入控件上。这个问题是可以解决的。箭头键的问题根本不存在:这些键与其他键没有区别;它们甚至不是状态键(您还需要模拟它)。解决方案取决于您想要使用什么:System.Windows.Forms
,WPF或其他。
另外,对于高质量的键盘,最好通过P / Invoke使用Windows APISendInput
。 (如果你这样做,它也用箭头解决你的问题:-))P / Invoke代码已经为你编写,请看下面。请参阅:
http ://msdn.microsoft.com/en-us/library/windows/desktop/ms646310%28v=vs.85%29.aspx [ ^ ],
< a href =http://www.pinvoke.net/default.aspx/user32.sendinput> http://www.pinvoke.net/default.aspx/user32.sendinput [ ^ ]。
另见我过去的答案:
申请重点关注和失败 [ ^ ],
创建虚拟键盘 [ ^ ],
在BACKSPACE按钮上编程 [ ^ ],
应用程序重点获取和失败 [ ^ ],
用于WPF应用程序的软件虚拟键盘 [ ^ ]。
-SA
No, this is not as simple as you may think. There are some problems, one of them: the screen keyboard can grab keyboard focus, which should stay on the data input control. This problem is solvable. The problem of arrow keys simply does not exist: those keys are no different from other keys; they are not even status keys (which you also will need to emulate). The solution depends on what do you want to use:System.Windows.Forms
, WPF, or something else.
Also, for a good-quality keyboard, you should better use Windows APISendInput
, via P/Invoke. (If you do, it also solves your problem with arrows :-)) The P/Invoke code is already written for you, please see below. Please see:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms646310%28v=vs.85%29.aspx[^],
http://www.pinvoke.net/default.aspx/user32.sendinput[^].
See also my past answers:
Application focus getting and losing[^],
Creating a Virtual Keyboard[^],
Programming on BACKSPACE button[^],
Application focus getting and losing[^],
A software Virtual Keyboard for your WPF apps[^].
—SA
这篇关于嗨,我在屏幕键盘上制作。它很简单......我是C#编程的新手......我不知道如何编写箭头代码? :-(的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文