Is there any option to set the height if a CMenu?
I know one can draw a custom menu item and use a custom size there CMenu::MeasureItem, but is there a way to set/change the height of the menu(bar) itself?
Thanks.
Is there any option to set the height if a CMenu?
I know one can draw a custom menu item and use a custom size there CMenu::MeasureItem, but is there a way to set/change the height of the menu(bar) itself?
Thanks.
Copyright © 2021 Jogjafile Inc.
Changing the height of a menu-bar is relatively easy, if your menu-bar is derived from the CMFCMenuBar class*. In this case, you simply need to override the
CalcLayoutmember and specify the required height in the.ymember of the returnedCSizeobject. Here's a minimal example:To use such a menu-bar, you need only to declare it as a member of your main frame window and then create it and set its style/properties when handling the
WM_CREATEmessage for that frame window (typically, inMFCapps, this will be in theOnCreate()member override).Note: You could, in theory, use this method with any base-class that has the
CalcLayoutmember (such asCMFCToolbar); however, theCMFCMenuBarclass allows the framework to handle all other expected actions from the contained menu.