在 VB6 中为工具栏控件创建键盘快捷键
在我的 VB6 项目中,我在主 MDI From(不是菜单栏)中仅使用工具栏控件,工具栏有大图片表示新建、保存、查看、帮助等操作。我想知道是否有任何方法可以创建键盘这些操作的捷径。据我所知,MS Windows Common Controls 6.0 的工具栏控件的属性没有显示任何相关选项来执行此操作。由于 MDI 表单没有任何按键事件,因此我也无法通过关联按键来创建快捷方式。我不想在我的表单中使用菜单栏,因为它的项目很少,所以只有工具栏可以完成这项工作。请提出任何关于工具栏按钮快捷方式的想法...... :-|提前致谢.............
In my VB6 project, I'm using only Toolbar Control in main MDI From (Not menubar), The Toolbar has big pictures denoting actions like New, Save, View, Help etc. I wanted to know if there is any way to create keyboard short-cut for these actions. As far as I know, properties of Toolbar control of MS Windows Common Controls 6.0 isn't showing any relative option to do this. As MDI form doesn't have any key events, I can't create short-cuts by associating keys as well. I don't want menu bar in my form as it has very few items so only Toolbar makes the job. Please suggest any idea to have short-cuts for toolbar buttons...... :-| Thanks in advance.............
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一种方法是使用本地
WH_KEYBOARD
挂钩,这篇文章解释了如何操作(并提供了一个库)。One way is to use a local
WH_KEYBOARD
hook, this article explains how (and provides a library).将关键事件添加到您的表单中。然后,您可以通过让快捷方式调用与菜单栏的鼠标按下事件相同的函数来处理快捷方式。
例如,您可能有类似
“Then”的按键,检查 Alt+S 等,并让它调用 DoSave()
Add a key event to your form. You could then process the short cuts by having them call the same function that would have been called on the mouse down event for the menubar.
For example you might have something like
Then in your keypress check for Alt+S etc, and have it call DoSave()