RolandAZ
asked on
Toolbar's images not showing in 256 color mode
Hello!
Hello!
Using plain Win32 Api
...I have an app with a toolbar with bitmap images in 256
colors indexed . The
toolbar displays well in W2K 24-bit True Color graphics mode. But when I
changed
W2k's graphics mode to 256 colors, the toolbar was created and displayed
sans the images.
How do I solve the mystery of the disappearing images?
What guidelines should I follow so bitmaps for toolbars(or any other window
using bitmaps)
will display properly?
How do I create bitmaps to display properly in all color modes? And how do I insert them into a toolbar, using CreateToolbarEx using whole bitmaps and CreateWindowEx using imagelists?
I'll add another 100 points to the one who gives the suitable solution to the problem!
Thanks in advance!
Maimee Arai
Hello!
Using plain Win32 Api
...I have an app with a toolbar with bitmap images in 256
colors indexed . The
toolbar displays well in W2K 24-bit True Color graphics mode. But when I
changed
W2k's graphics mode to 256 colors, the toolbar was created and displayed
sans the images.
How do I solve the mystery of the disappearing images?
What guidelines should I follow so bitmaps for toolbars(or any other window
using bitmaps)
will display properly?
How do I create bitmaps to display properly in all color modes? And how do I insert them into a toolbar, using CreateToolbarEx using whole bitmaps and CreateWindowEx using imagelists?
I'll add another 100 points to the one who gives the suitable solution to the problem!
Thanks in advance!
Maimee Arai
PPS
An alternative to subclassing the window is you use the NM_CUSTOMDRAW (CDDS_PREPAINT) notification and select the palette here. Note this feature is only supported on ComCtl32.dll v4.7 and later... then again most people do have this now as its included with Internet Explorer.
An alternative to subclassing the window is you use the NM_CUSTOMDRAW (CDDS_PREPAINT) notification and select the palette here. Note this feature is only supported on ComCtl32.dll v4.7 and later... then again most people do have this now as its included with Internet Explorer.
PPS
An alternative to subclassing the window is you use the NM_CUSTOMDRAW (CDDS_PREPAINT) notification and select the palette here. Note this feature is only supported on ComCtl32.dll v4.7 and later... then again most people do have this now as its included with Internet Explorer.
An alternative to subclassing the window is you use the NM_CUSTOMDRAW (CDDS_PREPAINT) notification and select the palette here. Note this feature is only supported on ComCtl32.dll v4.7 and later... then again most people do have this now as its included with Internet Explorer.
ASKER
Thanks, Rob, for the tip!
Could you please send me your working example that used "subclassing" the toolbar and one using NM_CUSTOMDRAW in Win32 API C, or in non-MFC C++ ?
Send it to rolandaz@hotmail.com
Thanks again!
I'm increasing the points by 100...
another 100, when I have incorporated your solution and satisfied my program's need. I hope it will...
Could you please send me your working example that used "subclassing" the toolbar and one using NM_CUSTOMDRAW in Win32 API C, or in non-MFC C++ ?
Send it to rolandaz@hotmail.com
Thanks again!
I'm increasing the points by 100...
another 100, when I have incorporated your solution and satisfied my program's need. I hope it will...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Great programming!
Thanks, Rob!
The problem lies in the fact that the toolbar doesn't select or realise a palette before drawing itself. Thus when running on a palettised display it attempts to draw using the default 16 standard colours (which usually doesn't work very well).
The solution is to subclass the toolbar control and then replace the WM_PAINT handler with something like the following:
BeginPaint(hWnd,&ps);
hopal=SelectPalette(ps.hdc
RealizePalette(ps.hdc);
flags=PRF_CHECKVISIBLE|PRF
if (ps.fErase) flags|=PRF_ERASEBKGND;
SendMessage(hWnd,WM_PRINT,
SelectPalette(ps.hdc,hopal
EndPaint(hWnd,&ps);
return 0;
The above selects and realises a palette before using WM_PRINT to get the control to draw itself using the newly selected palette.
Rob
PS For those extra 100 pts, I'll send you a full working example - post your email here.