要求最终用户动态分配键盘快捷键

发布于 2024-12-26 13:32:49 字数 204 浏览 3 评论 0原文

我有一个要求,最终用户可以在表单中修改键绑定。

我如何完成这个改变?到目前为止,键盘快捷键是静态的,我已经使用类似

if(key=='Z' & key=='Ctrl')
 //then undo

这样的基本 if 条件在 keydown 事件中处理了它们。

我如何在 C# 中实现这一点

I have a requirement where the keybindings can be modified by the end user in a form.

How do i accomplish this change ? As of now the keyboard shortcuts are static and i have handled them in the keydown event using a basic if condition like ,

if(key=='Z' & key=='Ctrl')
 //then undo

this way .

How do i accomplish this in C#

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

停滞 2025-01-02 13:32:49

您可以创建一个查找结构。关键是可能的命令或组合键 - 取决于您想要执行的操作。在键处理路由中,您可以使用键代码组合查询查找(在当前实例运行时从配置和/或手动更改的绑定生成),结果将是命令/操作。

You could create a lookup structure. The key is the possible command or the key combination - depending what you want to do. in the key handling routing, you can query the lookup (generated from config and/or manually changed bindings while the current instance runs) with the keycode combination and the result would be the command/action.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文