开发者

How can I include a DropDownList in a menu bar using the Windows API?

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开发者_Python百科 matter or where start to learn on the topic would be appreciated.


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.

  • There's a complete description of how you might do this using a toolbar available here:
    Creating an Internet Explorer-style Menu Bar

    How can I include a DropDownList in a menu bar using the Windows API?

  • And you can find sample code for the rebar here: Using Rebar Controls

    How can I include a DropDownList in a menu bar using the Windows API?


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜