Author Topic: Skinned Menu Question  (Read 3381 times)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Skinned Menu Question
« on: July 06, 2019, 10:34:45 pm »
Patrice,

Can your skinned menus display bitmaps in the left column where ticks/bullets appear in a regular menu?
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Skinned Menu Question
« Reply #1 on: July 07, 2019, 09:42:29 am »
Not directly, you have to use an owndrawn menu for that purpose.

There is an example on how to do it in gMap64

Search for:
GetMenuIcon
AddResource
RemoveAllImageResource


and of course:
    case WM_DRAWITEM:
         lpdis = (DRAWITEMSTRUCT*) lParam;
         if (lpdis->CtlType == ODT_MENU) {
             img = GetMenuIcon(lpdis->itemID);
             wcscopy(zTxt, GetMenuText(lpdis->itemID));

             if (CheckStyle(lpdis->itemState, ODS_SELECTED)) {
                 SetTextColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
                 SetBkColor(lpdis->hDC, GetSysColor(COLOR_HIGHLIGHT));
             } else {
                 SetTextColor(lpdis->hDC, GetSysColor(COLOR_MENUTEXT));
                 SetBkColor(lpdis->hDC, GetSysColor(COLOR_MENU));
             }

             if (CheckStyle(lpdis->itemState, ODS_GRAYED)) {
                 SetTextColor(lpdis->hDC, GetSysColor(COLOR_GRAYTEXT));
                 ImgAttr = ZI_SetImageAlpha(80);
             }

             ExtTextOut(lpdis->hDC, 6 + 16 + lpdis->rcItem.left,
                        lpdis->rcItem.top + 1, ETO_OPAQUE, &lpdis->rcItem, zTxt, lstrlen(zTxt), NULL);

             if (GdipCreateFromHDC(lpdis->hDC, graphics) == 0) {
                 GdipGetImageWidth(img, imgW); GdipGetImageHeight(img, imgH);
                 GdipDrawImageRectRectI(graphics, img,
                                        lpdis->rcItem.left + 1, lpdis->rcItem.top + 1, imgW, imgH,
                                        0, 0, imgW, imgH, UnitPixel, ImgAttr, 0, 0);
                 GdipDeleteGraphics(graphics);
             }

             return 1;
         }
         break;


The problem with the skinned one, is that it has no idea of the image to use, nor if the graphic chart of the icon will match the current theme.

The best solution is to create the specific ownerdrawn popup menu directly inside of OR, using the same scope than in WinLIFT.

Or to use a GDImage overlay menu like in BB64 (see attachment), but there is no embedded child menu.
That is the same concept that in the OR's help topic list.

« Last Edit: July 07, 2019, 09:51:12 am by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)