如何使用 Windows API 在菜单栏中包含 DropDownList?

发布于 2024-10-16 19:28:14 字数 134 浏览 8 评论 0原文

假设使用 C++ 为 Win32 API 进行编程,我想知道是否可以在菜单栏中包含 DropDownList(具有 CBS_DROPDOWNLIST 样式的 COMBOBOX 窗口)。

任何有关此事的线索或从哪里开始学习该主题将不胜感激。

Assuming programming in C++ for the Win32 API, I would know if it is possible to include a DropDownList (COMBOBOX window with CBS_DROPDOWNLIST style) in a menu bar.

Any light in that matter or where start to learn on the topic would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

铜锣湾横着走 2024-10-23 19:28:14

所有者绘图是您自定义内置 API 菜单的唯一选择。这不仅是后背的巨大痛苦,而且仍然达不到你想要的效果。您必须手动绘制组合框并编写代码来响应所有鼠标事件,而不是仅仅放入标准组合框控件。

我的建议是使用工具栏或rebar控件 模拟菜单栏,而不是标准菜单栏。这就是 Windows(和 Internet)资源管理器绘制菜单栏的方法,它为您提供了更多的灵活性来包含哪些控件。

Owner drawing is your only option for customizing the built-in API menus. Not only is that a giant pain in the rear, it still won't produce the effect that you want. You'd have to draw the combo box by hand and write code to respond to all the mouse events, instead of just dropping in a standard combo box control.

My suggestion is to use either a toolbar or a rebar control that simulates a menu bar, rather than the standard menu bar. This is what Windows (and Internet) Explorer does to draw its menu bar, and it provides you with a lot more flexibility in what controls can be included.

好多鱼好多余 2024-10-23 19:28:14

如果您准备好处理所有绘制消息,您最终可以对应用程序的客户区执行任何操作。您准备投入多少工作和代码?

If you're prepared to handle all paint messages you can ultimately do anything to the client area of your application. How much work and code are you prepared to put in?

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