views:

116

answers:

2

In a win32 application, I want to have a button with an icon which looks gray when the button is disabled and 'brighter' when the mouse hovers.

I know I can create three bitmaps with an icon editor, but since the icon can be user selected and loaded from the disk, I would like to create the other two versions programmatically.

So, starting with a handle to an image, I would like to:
- Create a new image with all colors converted to grey.
- Create a new image with all colors shifted to white or yellow.

Can this be done using win32 api calls?

Examples in any language will be appreciated.

A: 

If the icon is user-selected do you control the format? If not you'll probably want to incorporate an image library or external process like DevIL or Imagemagick which handle more formats than Microsofts API's are likely to..

SpliFF
Yes, I'll only accept a few basic image formats. Imagine I already have a `HANDLE` returned by the `LoadImage` API call
Carlos Gutiérrez
+1  A: 

Maybe the good old DrawState function will suffice. (For some reason it is now listed as only available from Win2000 which is not true.)

And maybe not, in which case you might want to use SetColorAdjustment function.

GSerg
Thanks! `SetColorAdjustment` is what I was looking for.
Carlos Gutiérrez