简体   繁体   中英

MFC ownerdraw menu size

I'm wondering how I can set the size of an ownerdraw CMenu using his own text.

Looking at the documentation:

void CColorMenu::MeasureItem(LPMEASUREITEMSTRUCT lpMIS)
{
   // all items are of fixed size
   lpMIS->itemWidth = COLOR_BOX_WIDTH;
   lpMIS->itemHeight = COLOR_BOX_HEIGHT;
}

But using this approach I have the same size for all the menus. How I can have dynamic dimension of the menu and submenu as for the standard windows menu?

You have to identity the item you want to draw by the given information in the MEASUREITEMSTRUCT. Just read the docs ind the MSDN .

You receive this message for each item in the menu.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM