注册热键 [英] Register Hotkey

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

问题描述

我有这个功能:RegisterGlobalHotKey(Keys.F6,MOD_SHIFT | MOD_CONTROL);会调用API在系统中注册全局快捷键.void RegisterGlobalHotKey(按键热键,整数修饰符)

I have this function: RegisterGlobalHotKey(Keys.F6, MOD_SHIFT | MOD_CONTROL); which call an API to register a global shortcut key in the system. void RegisterGlobalHotKey(Keys hotkey, int modifiers)

我创建了一个小的选项表单,以将该键设置为不是固定值的变量,如下所示:RegisterGlobalHotKey(VARIABLE1,VARIABLE2 | VARIABLE3);

I created a small options form to set this keys to be variables not fixed values like this: RegisterGlobalHotKey(VARIABLE1, VARIABLE2 | VARIABLE3);

请参阅随附的选项表以了解更多信息

See the attached option form to understand more

主要问题是如何将组合框的字符串值转换为Keys枚举值

The main problem is how to convert the combobox string values to Keys enum value

推荐答案

假设您可以要求用户准确键入Enum值的名称,则可以将文本传递给 Enum.Parse 并将返回具有指定名称的枚举值.

Assuming that you can require users to type in the name of the Enum values exactly, you can pass the text to Enum.Parse and that will return the enum value with the specified name.

这篇关于注册热键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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