VB6 协商菜单
我有一个 vb6 表单,我在其中放置了 ocx 控件。 在窗体上设置 NegotiateMenus 显示 ocx 的控件(这就是我想要的)。 然后我将自己的控件添加到表单中。 当该控件获得焦点时,ocx 中的菜单就会消失。
无论谁拥有焦点,如何始终保持 ocx 中的菜单显示?
I have a vb6 form that I've put an ocx control on. Setting NegotiateMenus on the form displays the ocx's control (which is what I want). I then add my own control to the form. When that control has focus, the menu from the ocx disappears.
How can I always keep the menu from the ocx displayed, regardless of who has focus?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
丹,我记得很多年前曾尝试做类似的事情,但未能实现。
我最终做的是添加一个空的顶级菜单,其标题与 OCX 控件上的菜单相同,并始终禁用它。
然后,当 OCX 获得焦点时,我将隐藏禁用的菜单项,使其看起来好像单击 OCX 已启用该菜单项。 它节省了菜单出现和消失时所有丑陋的跳跃(显然,一旦 OCX 失去焦点,我将再次显示禁用的菜单)。
如果您仍然希望启用菜单项,则必须在表单中准确复制它,并在 Ocx 处于活动状态时隐藏它的版本(您还必须连接所有自己的事件以复制 OCX 上可用的功能) 。
据我所知,没有比这更简单的方法
了
Dan, I remember trying to do something similar many years ago, and could not achieve it.
What I ended up doing was adding a empty top level menu with the same caption as the menu on the OCX control, and having it always be disabled.
Then, when the OCX got focus I would hide my disabled menu item, making it look as if clicking on the OCX had enabled the menu item. It saves all the ugly jumping around as menus appear and disappear (obviously, once the OCX lost focus I would show the disabled menu again).
If you still want the menu item enabled, you would have to replicate it exactly in your form, and hide your version of it when the Ocx is active (you would also have to wire all your own events to replicate the functionality available on the OCX.
There is no easier way of doing this at I know of.
Apologies not be being more helpful.