问题
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:
Subclassing CMenu to my own SkinnedMenu, but it is not created by our code but by a
GetMenu()
call in a mainframe class deriving fromCFrameWnd
. The only thing I can find here is its method signature, defined inafxwin.h
so then how could I make use my own subclassed menu?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.
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 setinfo.hbrBack = skin.GetSysColorBrush(COLOR_MENU)
the only colour that changes is the background of the dropdown, not the main menu itself.Other :)
来源:https://stackoverflow.com/questions/11673801/how-to-skin-mfc-main-menu