SNC
SNC

Reputation: 59

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?

Upvotes: 0

Views: 1032

Answers (1)

xMRi
xMRi

Reputation: 15375

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.

Upvotes: 1

Related Questions