密钥组合c#以外的热键 [英] key combination c# other than hotkeys

查看:84
本文介绍了密钥组合c#以外的热键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实现快捷键组合逻辑,例如

I am implementing shortcut key combination logic like

<br />
Ctrl + A




<br />
Ctrl + Alt + D





但现在我正在寻找如果没有热键组合就可以实现键盘组合键的技巧:A + D但没有得到任何正确的东西。



所以请帮助实现它。



更新



目前我无法添加热键组合以外的组合键。因为每当我按两个键时喜欢: A + D 它只返回单键ascii所以我没有得到两个键组合。



我使用以下内容 WinForms和WPF中的全局快捷方式



but now I am looking for a trick to implement keyboard key combination without hotkey combination like :A + D but not getting any right things.

So please help to implement it.

Updated

Currently I am not able to add key combination other than hotkey combination.because whenever I am pressing two keys like : A + D it returns only single keys ascii so I am not getting two keys combination.

I have used following stuff Global Shortcuts in WinForms and WPF

推荐答案

键盘不能那样工作:或者说键盘驱动程序不能那样工作。

有三个修饰符可以轻松组合使用的键 - SHIFT,CTRL和ALT - 但没有内置机制来处理组合按下的任何一对其他键。它可能已经完成 - 但是您必须使用KeyDown和KeyUp事件自己完成所有操作,并记录当前关闭的键和什么不关键 - 这可能会导致标准键盘输入出现问题。 (为什么你认为VS中所有这些组合都是CTRL + K,键序列而不是组合?)



坦率地说,我认为它可能会发生要做到正确很麻烦,并在发布时混淆用户。我会看看自己是否可以重新设计我的设计。
Keyboards don't work like that: or rather keyboard drivers don't work like that.
There are three "modifier" keys which can be easily used in combination - SHIFT, CTRL, and ALT - but there is no "built in" mechanism for handling any pair of the other keys pressed in combination. It can probably be done - but you would have to do it all yourself using the KeyDown and KeyUp events, and recording what key is currently down and what isn't - and it's likely to cause some problems with "standard" keyboard input. (Why do you think all of these "combinations" in VS are "CTRL+K, key" sequences instead of combinations?)

Frankly, I think it probably going to be a lot of hassle to get right, and confuse users when you release it. I'd see if I could re-work my design instead, myself.


这篇关于密钥组合c#以外的热键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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