How to skin MFC main menu

爱⌒轻易说出口 提交于 2019-12-29 09:31:15

问题


I got a menu in an existing MFC application that has a standard MFC main menu.

But I would like to change its background colour so that it appears to more seamlessly belong to the rest of the application.

  • First picture: An MFC main menu. The application is skinned blue, as seen in the toolbar, but the menu is still standard grey background colour.

  • Second Picture: Spotify's menu, skinned to fit into the rest of the colors.

I have not found any examples on anything similar. Could you please point me towards how to achieve this?

Approaches I thought of:

  1. Subclassing CMenu to my own SkinnedMenu, but it is not created by our code but by a GetMenu() call in a mainframe class deriving from CFrameWnd. The only thing I can find here is its method signature, defined in afxwin.h so then how could I make use my own subclassed menu?

  2. Removing the entire menu and add my own custom menu buttons, in a row, making it look like a menu. Maybe this is what spotify have done, as they have also removed the Windows window frame.

  3. Editing the existing CMenu in some way, but the only customization I am able to find right now is modifying its MENUINFO. For example if I set info.hbrBack = skin.GetSysColorBrush(COLOR_MENU) the only colour that changes is the background of the dropdown, not the main menu itself.

  4. Other :)

来源:https://stackoverflow.com/questions/11673801/how-to-skin-mfc-main-menu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!