A. Apvrille
April 22nd, 1999, 09:05 AM
I've got a list view control - report style. I have an image list attached to it, and in some columns I display small icons.
How do I manage icons to show correctly in 256 color mode ?
I probably need to set the icon's palette before drawing it, but I don't know how I can manage palettes in list view controls.
Has somebody got his working ?
--
Axelle Apvrille - MSI
Clive Walker
April 22nd, 1999, 09:27 AM
You could create a median palette (a palette with a range of 256 colours) and select this and realize it before drawing your icon. You could then rely on Windows colour matching to get the closest match from your palette, this might by satisfactory, it depends what your trying to do...
A. Apvrille
April 23rd, 1999, 03:08 AM
Thanks for your answer. I've tried something like this, but result isn't really good.
1/ For each icon, I store its palette.
2/ On WM_PAINT,
hdc = GetDC(list view wnd);
I get my palette, then SelectPalette(hdc,mypalette, FALSE) (foreground palette).
RealizePalette.
Draw Image list using ImageList_Draw.
I put back old palette (SelectPalette(hdc, holdpalette, TRUE) ) in background.
return 0 to say I have managed the message.
Am I missing something ?
Result is not satisfactory (it's doing something but not much). When I have a look at NT's explorer, it manages to display nearly perfect icons. So, it's possible to do better. How does it achieve that ?!
--
Axelle Apvrille - MSI