Setting the width of a menu in the Windows API

后端 未结 3 1074
名媛妹妹
名媛妹妹 2021-01-28 07:22

I\'m creating a custom control in wxWidgets that displays a menu as part of it, and currently working on the Windows side of things. wxWidgets doesn\'t have a way of setting th

3条回答
  •  被撕碎了的回忆
    2021-01-28 07:27

    With the handle of the menu, you can cycle through the menu items and call SetMenuItemInfo, indicating that you want to owner-draw the menu items. When you do this, the window that the menu is attached to will receive the WM_MEASUREITEM message, which you would then respond to by setting the dimensions required for the menu. It is here you can set your width.

    Of course, this means you have to subclass the windows message handler for the window that contains the menu.

提交回复
热议问题