从数据库设置表单快捷方式 [英] Setting Form Shortcut from DB
本文介绍了从数据库设置表单快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要设置表单的快捷方式.通常我们可以使用form_keydown事件设置快捷方式.
现在,我要修复数据库中的快捷方式.
假设将Ctrl + Alt + P设置为表单.
我可以从数据库读取值.现在我在字符串Variable中具有"Ctrl + Alt + P".
我们如何才能将其指定为某种形式的快捷方式??
谢谢与问候,
Pal
Hi,
I need to set shortcuts for forms. normally we can set shortcuts using form_keydown event.
Now I want to fix the shortcuts from DB.
Assume Ctrl+Alt+P is set to a form.
I can read the value from DB. now i am having "Ctrl+Alt+P" in a string Variable.
How can We assign this as shortcut for a certain form???
Thanks & Regards,
Pal
推荐答案
^ ]
如果您将快捷方式作为字符串存储在数据库中,则可以基于+字符分割字符串,然后将每个元素映射为键 [
If you store the shortcuts in the database as a string, you can split the string based on + character and then map each element to proper enumeration in Keys[^].
As you have already done, use the KeyPreview property set to true and check for shortcuts in proper form event.
However, I feel that storing the shortcuts as text in the database is a bit awkward. Could you should consider a different kind of table design, for example shortcut key and ''boolean'' columns for ALT, SHIFT etc or even use the Keys enumerations, possibly as rows instead of columns....
这篇关于从数据库设置表单快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文