VB6 协商菜单

发布于 2024-07-04 20:36:04 字数 161 浏览 9 评论 0原文

我有一个 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 技术交流群。

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

发布评论

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

评论(1

一抹淡然 2024-07-11 20:36:04

丹,我记得很多年前曾尝试做类似的事情,但未能实现。
我最终做的是添加一个空的顶级菜单,其标题与 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.

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