DrawIconEx & ILD_BLEND50
-
Hello, I'm building owner drawn menus and when using this ImageList_DrawEx( himl, this->m_nIcon, lpdis->hDC, x, y, 0, 0, CLR_NONE, RGB(128,128,128), ILD_BLEND50 ); The icon color is only dimed, but not blended with the specified RGB color and yes my icon has a mask as I can draw it with ILD_MASK and I see a black icon painted which is the mask. Piece of MSDN help --------------------- rgbFg Foreground color of the image. This parameter can be an application-defined RGB value or one of the following values: CLR_NONE - No blend color. The image is blended with the color of the destination device context. CLR_DEFAULT - Default foreground color. The image is drawn using the system highlight color as the foreground color. fStyle Drawing style and, optionally, the overlay image. For information about specifying an overlay image index, see the comments section at the end of this topic. This parameter can be a combination of an overlay image index and one or more of the following values: ILD_BLEND25, ILD_FOCUS Draws the image, blending 25 percent with the blend color specified by rgbFg. This value has no effect if the image list does not contain a mask. ILD_BLEND50, ILD_SELECTED, ILD_BLEND Draws the image, blending 50 percent with the blend color specified by rgbFg. This value has no effect if the image list does not contain a mask. ------------------- Note: Using Win32 API, no MFC Thanks David -- modified at 17:25 Sunday 16th October, 2005
-
Hello, I'm building owner drawn menus and when using this ImageList_DrawEx( himl, this->m_nIcon, lpdis->hDC, x, y, 0, 0, CLR_NONE, RGB(128,128,128), ILD_BLEND50 ); The icon color is only dimed, but not blended with the specified RGB color and yes my icon has a mask as I can draw it with ILD_MASK and I see a black icon painted which is the mask. Piece of MSDN help --------------------- rgbFg Foreground color of the image. This parameter can be an application-defined RGB value or one of the following values: CLR_NONE - No blend color. The image is blended with the color of the destination device context. CLR_DEFAULT - Default foreground color. The image is drawn using the system highlight color as the foreground color. fStyle Drawing style and, optionally, the overlay image. For information about specifying an overlay image index, see the comments section at the end of this topic. This parameter can be a combination of an overlay image index and one or more of the following values: ILD_BLEND25, ILD_FOCUS Draws the image, blending 25 percent with the blend color specified by rgbFg. This value has no effect if the image list does not contain a mask. ILD_BLEND50, ILD_SELECTED, ILD_BLEND Draws the image, blending 50 percent with the blend color specified by rgbFg. This value has no effect if the image list does not contain a mask. ------------------- Note: Using Win32 API, no MFC Thanks David -- modified at 17:25 Sunday 16th October, 2005
ClickHeRe wrote:
ImageList_DrawEx( himl, this->m_nIcon, lpdis->hDC, x, y, 0, 0, CLR_NONE, RGB(128,128,128), ILD_BLEND50 ); The icon color is only dimed, but not blended with the specified RGB color
You realize that you're blending with medium gray, right? This is usually going to cause some dimming...
-
ClickHeRe wrote:
ImageList_DrawEx( himl, this->m_nIcon, lpdis->hDC, x, y, 0, 0, CLR_NONE, RGB(128,128,128), ILD_BLEND50 ); The icon color is only dimed, but not blended with the specified RGB color
You realize that you're blending with medium gray, right? This is usually going to cause some dimming...
-
I looked into this a bit, and have discovered that if you are using a manfiest (so that your program uses the v6 common controls on XP),
ImageList_DrawEx()
is broken, just as you found. Without the manifest (or on Windows versions prior to XP), the function works as documented, dithering the foreground color over the image. Interestingly,ImageList_Draw()
works fine, blending the system highlight color with the icon. -
I looked into this a bit, and have discovered that if you are using a manfiest (so that your program uses the v6 common controls on XP),
ImageList_DrawEx()
is broken, just as you found. Without the manifest (or on Windows versions prior to XP), the function works as documented, dithering the foreground color over the image. Interestingly,ImageList_Draw()
works fine, blending the system highlight color with the icon.Any thoughts on a function or way to achieve the same sort of end result and that would work on any machine. I want to grey the disabled icon and possibly apply this technique on other cases on the menus like normal unselected icons making the selected one the only true color icon. Thanks David
-
Any thoughts on a function or way to achieve the same sort of end result and that would work on any machine. I want to grey the disabled icon and possibly apply this technique on other cases on the menus like normal unselected icons making the selected one the only true color icon. Thanks David
There is an article here you should read then: CreateGrayScaleIcon A nice little function that creates a sharp-looking grayscale version of whatever is passed in. Also, it's pretty easy to modify the function to do other image manipulation on icons.