I’m finally getting around to adding icons to our pull down menus:

In this image, you can see that everything but the highlighted line is okay. The highlighted line is fine except for the icon, which is drawn in color, instead of grayed.
I’m basing my code off of a minimalist approach:
http://www.codeproject.com/Articles/16529/Simple-Menus-That-Display-Icons-Minimalistic-Appro?msg=4166441#xx4166441xx
Basically, this only requires that I draw the icon, and I don’t have to manage all aspects of a menu item using custom code. Pretty nifty.
It works for our purposes except when selecting a disabled (grayed) menu item.
But when the menu item is grayed and selected, then the drawn icon appears as it would if it were enabled. Wrong. 🙁
Yet the exact same drawing code works when the background is highlighted/selected.
That leads me to believe that there is some stated contained entirely in the HDC that must control how the icon is appearing – since the following code works under all conditions but selected:
::DrawIconEx(lpdis->hDC, lpdis->rcItem.left+0, lpdis->rcItem.top, pIcon->GetHandle(), pIcon->GetSize().cx, pIcon->GetSize().cy, 0, NULL, DI_NORMAL);
Does anyone know what state is encapsulated in the HDC that would control how DrawIconEx functions? If I can replicate the HDC state during selected drawing as found when not-selected-drawing, I should be able to generate the grayed icons without resorting the 30-50 line implementations that manually gray-scale the icon in memory.
You can use:
API function, with DSS_DISABLED flag, but I am not sure about the quality of the output.