|
Question : Need some help with MENUITEMINFO Structure (500 points grade A)
|
|
Hello, I need some help with my MENUINFO and MENUITEMINFO. I change my complete menu to green with MENUINFO ==> mnfo.hbrBack = CreateSolidBrush(RGB(0,255,0));
I would like to set a bitmap or icon before my ID_MY_HELP. This works with SetMenuItemBitmaps fine...but I have to change my bitmap/icon to a size of 13x13 I would like to add a bitmap/icon with size of 16x16. I tried this with MENUFINFO and MENUITEMINFO...but I need some help.
Is this okay? submenu->SetMenuItemInfo(ID_MY_HELP,&minfo,TRUE); ???????? I also get no result when I try to use MFT_MENUBARBREAK instead of MFT_BITMAP
Here is my code: //================================================================================== int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { //get the Main Menu CMenu* mmenu = GetMenu(); CMenu* submenu = mmenu->GetSubMenu(3);
MENUINFO mnfo; mnfo.cbSize = sizeof(mnfo); mnfo.fMask = MIM_STYLE|MIM_APPLYTOSUBMENUS|MIM_BACKGROUND|MIM_MAXHEIGHT; mnfo.dwStyle = MNS_CHECKORBMP; mnfo.cyMax = 1500; mnfo.hbrBack = CreateSolidBrush(RGB(0,255,0)); mmenu->SetMenuInfo(&mnfo); submenu->SetMenuInfo(&mnfo); MENUITEMINFO minfo; minfo.cbSize=sizeof(minfo); minfo.fMask=MIIM_STATE|MIIM_ID; minfo.fType=MFT_BITMAP; minfo.fState=MFS_HILITE; submenu->SetMenuItemInfo(ID_MY_HELP,&minfo,TRUE); //--------------------------------------------------------------------
if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || !m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) { TRACE0("Symbolleiste konnte nicht erstellt werden\n"); return -1; // Fehler bei Erstellung }
if (!m_wndStatusBar.Create(this) || !m_wndStatusBar.SetIndicators(indicators, sizeof(indicators)/sizeof(UINT))) { TRACE0("Statusleiste konnte nicht erstellt werden\n"); return -1; // Fehler bei Erstellung } m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); EnableDocking(CBRS_ALIGN_ANY); DockControlBar(&m_wndToolBar); //--------------------------------------------------------------------- //Load Bitmaps ASSERT(m_CheckBitmap.LoadBitmap(IDB_CheckBitmap)); ASSERT(m_UnCheckBitmap.LoadBitmap(IDB_UnCheckBitmap));
//ASSERT(submenu->SetMenuItemBitmaps(ID_MY_HELP_BUTTON,MF_BYCOMMAND,&m_CheckBitmap, &m_UnCheckBitmap)); return 0; } //===================================================================================
|
|
Answer : Need some help with MENUITEMINFO Structure (500 points grade A)
|
|
instead of submenu->SetMenuItemInfo(ID_MY_HELP,&minfo,TRUE); try submenu->SetMenuItemInfo(ID_MY_HELP,&minfo,FALSE);
|
|
|
|