Hi, @ZH Chan
The background color can also be changed by setting the first SubMenu Properties> behavior> break.
Snippet:
CMenu* pMenu = new CMenu;
pMenu->LoadMenu(IDR_MENU1);
CMenu* pSubMenu = pMenu->GetSubMenu(0);
CBitmap bmp;
CBrush m_BKBrush;
bmp.LoadBitmap(IDB_BITMAP1);
m_BKBrush.CreateSolidBrush(0x00ffee/*color*/);
MENUINFO mnInfo;
memset(&mnInfo, 0, sizeof(MENUINFO));
mnInfo.cbSize = sizeof(MENUINFO);
mnInfo.fMask = MIM_BACKGROUND;
mnInfo.hbrBack = m_BKBrush;
::SetMenuInfo(pSubMenu->m_hMenu, &mnInfo);
m_BKBrush.Detach();
m_menubutton.m_hMenu = pMenu->GetSubMenu(0)->GetSafeHmenu();
Best regards,
Minxin Yu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our [documentation][3] to enable e-mail notifications if you want to receive the related email notification for this thread.