A
Artimonier
Guest
Hi,
I tried for some time to get my menu on the caption bar (using an extended client area via DwmExtendFrameIntoClientArea) to display a grey backdrop when being hovered by the mouse but to no success.
I tried calling FillRect on the button rectangle but it displays a white tint instead of grey.
FillRect(toolbarDraw->nmcd.hdc, &toolbarDraw->nmcd.rc, CreateSolidBrush(RGB(138, 138, 138)));
Then I tried using DrawIcon with an icon I created programatically
ULONG u[1] = { 0x4287f5 };
ICONINFO backdropInfo = { TRUE, NULL, NULL, CreateBitmap(1, 1, 1, 1, 0), CreateBitmap(1,1,1,32,&u) };
HICON backdrop = CreateIconIndirect(&backdropInfo);
DrawIconEx(toolbarDraw->nmcd.hdc, toolbarDraw->nmcd.rc.left, toolbarDraw->nmcd.rc.top, backdrop, WIDTH, HEIGHT, NULL, NULL, DI_NORMAL);
but the result is the same.
Edit: DrawIcon seems to work with other icons, they are shown correctly and colored (tested it using IDI_APPLICATION). The problem may be how I constructed my icon. I don't really have experience with bit masks and all that. I wonder though if there is any way to do this using FillRect.
I also tried creating (I don't have the code anymore) a compatible DC, a DIB section, drawing on it and copying it to the source via BitBlt but - you guessed it - the result is the same.
What I want to achieve is a backdrop sort of like the minimize and maximize buttons.
I am obviously looking for a solution but I'm also asking myself why do all the drawing functions behave differently on the caption bar.
Thanks.
Continue reading...
I tried for some time to get my menu on the caption bar (using an extended client area via DwmExtendFrameIntoClientArea) to display a grey backdrop when being hovered by the mouse but to no success.
I tried calling FillRect on the button rectangle but it displays a white tint instead of grey.
FillRect(toolbarDraw->nmcd.hdc, &toolbarDraw->nmcd.rc, CreateSolidBrush(RGB(138, 138, 138)));
Then I tried using DrawIcon with an icon I created programatically
ULONG u[1] = { 0x4287f5 };
ICONINFO backdropInfo = { TRUE, NULL, NULL, CreateBitmap(1, 1, 1, 1, 0), CreateBitmap(1,1,1,32,&u) };
HICON backdrop = CreateIconIndirect(&backdropInfo);
DrawIconEx(toolbarDraw->nmcd.hdc, toolbarDraw->nmcd.rc.left, toolbarDraw->nmcd.rc.top, backdrop, WIDTH, HEIGHT, NULL, NULL, DI_NORMAL);
but the result is the same.
Edit: DrawIcon seems to work with other icons, they are shown correctly and colored (tested it using IDI_APPLICATION). The problem may be how I constructed my icon. I don't really have experience with bit masks and all that. I wonder though if there is any way to do this using FillRect.
I also tried creating (I don't have the code anymore) a compatible DC, a DIB section, drawing on it and copying it to the source via BitBlt but - you guessed it - the result is the same.
What I want to achieve is a backdrop sort of like the minimize and maximize buttons.
I am obviously looking for a solution but I'm also asking myself why do all the drawing functions behave differently on the caption bar.
Thanks.
Continue reading...