1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
//***************
case WM_DRAWITEM:
{
DRAWITEMSTRUCT *DrawMenuStructure=(DRAWITEMSTRUCT *)lParam;
if(DrawMenuStructure->CtlType==ODT_MENU)
{
MENUITEMINFO menuInfo;
menuInfo.cbSize = sizeof(MENUITEMINFO);
menuInfo.fMask=MIIM_DATA;
GetMenuItemInfo((HMENU)DrawMenuStructure->hwndItem,DrawMenuStructure->itemID, FALSE, &menuInfo );
Menu *mMenu = (Menu *) menuInfo.dwItemData;
if(mMenu->MenuDrawed)
mMenu->MenuDrawed(DrawMenuStructure->hDC,DrawMenuStructure->rcItem,&MenuItemSize,DrawMenuStructure->itemAction, DrawMenuStructure->itemState);
}
}
break;
//***************
mnuSecondHello.MenuDrawed=[](HDC MenuHDC, RECT MenuRect,SIZE *MenuItemSize, UINT Action, UINT MenuState)
{
SetTextColor(MenuHDC, ChFont.rgbColors);
HFONT hfDrawed=CreateFontIndirect(ChFont.lpLogFont);
SelectFont(MenuHDC,hfDrawed);
*MenuItemSize=GetStringSize(mnuSecondHello.Caption, MenuHDC);
string strCaption = mnuSecondHello.Caption;
SetBkMode(MenuHDC, TRANSPARENT);
if(Action==ODA_SELECT)
{
DrawControlBackground(MenuHDC,"MENU",MENU_POPUPITEM,MPI_HOT,MenuRect);
}
DrawText(MenuHDC,&strCaption[0], -1,&MenuRect,DT_CENTER|DT_LEFT| DT_EXPANDTABS);
DeleteFont(hfDrawed);
};
|