I have two different bitmap that I use as toolbar bitmap.
The small one, works fine, but the big one give me problems.

I have WindowsXp with visual styles activated and I use common controls 6 in my application.
I create the first toolbar with CreateToolbarEx, and buttons are trasparent

If I create the second toolbar (the big one) with CreateToolbarEx, button are trasnparent but have a

strange blue effect (like a shadow) (it's difficoult to explain), either with comm crtls 6 and 5.

If I create the second toolbar with CreateWindowEx, I have 2 choiche:

1) use TB_SETIMAGELIST to add the bitmap

a) If I use ImageList_LoadImage, ...., IMAGE_BITMAP,

LR_LOADMAP3DCOLORS+LR_CREATEDIBSECTION+LR_LOADTRANSPARENT the image background is of the window color. So, if I have comm ctr 5, the buttons are transparent, but with comm ctrl 6, buttons aren't transparent

b) If I use ImageList_LoadBitmap to create the imagelist, the resulting image has only few colors (about 6) and the background is gray

2) use TB_ADDBITMAP to add the bitmap. The result is like CreateToolbarEx: a strange blue shadow.


Where is the problem? How can I solve it?
Posted on 2004-01-20 16:14:59 by greenant
I don't use CreateToolbarEx, you should load your bitmaps as a DIB section with ImageList_LoadImage, that allows you to specify the transparent color. Then assign the imagelist to your toolbar, this will solve alot of stupid problems with LoadImage and CreateToolbarEX. You should also be aware that there is a known bug with LoadImage and color mapping with some versions of Windows.

; 0FFFFFFh = background color

invoke ImageList_LoadImage, [hInst], ID_BMP, YSIZE, nMAX, 0FFFFFFh,\
IMAGE_BITMAP, LR_CREATEDIBSECTION
mov [hIml],eax
invoke ImageList_SetBkColor, [hIml], CLR_NONE
invoke SendMessage, [hToolBar], TB_SETIMAGELIST, 0, [hIml]
Posted on 2004-01-20 17:16:17 by donkey
It works fine with the disabled bitmap. The disabled bitmap is like the big bitmap but in gray scale.
For the color bitmap, I see the strange blue shadow
Posted on 2004-01-20 17:40:27 by greenant
The image is pallettized so it will be remapped to the system pallette which has different colors than the one used in the image, run it through Toolbar Paint and save it as a 256 color image, it should be fine.
Posted on 2004-01-20 17:46:18 by donkey
Thanks. Now it works.
The big toolbar was created through tbpaint, and then edited with paint shop pro 8.

But now works. Thanks
Posted on 2004-01-21 02:35:43 by greenant
Hi Greenant,

No problem, I find that PaintShop Pro tends to do stuff to images without asking :) I used it on the Mac to do my toolbars before I wrote TBPaint. You probably have the default set to saving as palettized, you will find that this is rarely good for toolbars (except grayscale). I am not sure how to change it in the PC version but it should be in options somewhere. OTOH you could just use TBPaint it is designed for the task, I didn't check but the TBPaint one is probably smaller (in file size) as well, palettized 256 color is only efficient over 64x64 I think.
Posted on 2004-01-21 02:44:53 by donkey
OTOH? What does it mean?

Now I have another problem. I have a treeview. I use the ImageList_LoadImage to load a bitmap (created with tbpaint) and use it in the imagelist associated with the treeview.
Then I use SHGetFileInfo to get CdRom icons. Then I use ImageList_ReplaceIcon to insert these icons in my imagelist.
I have windows xp.
With common controls 6 it works fine
With common controls 5 the cdrom icons (only them) have a black background and not a transparent background.
Why?
Posted on 2004-01-21 04:20:15 by greenant
Probably because the icons are alpha blended. CC6 will draw them with the alpha channel (probably at 0 so it looks black without it but is fully transparent with alpha). When you change to CC5 there is no more alpha blending in the common control functions so it doesn't work. There is nothing I can think of to correct this off hand, the system seems to default to the alpha icon everytime. Though there must be a way to load the normal version of the icon. Just be sure to use the manifest and older Windows versions will have the older non-alpha icons anyway.

OTOH = "On the other hand"
Posted on 2004-01-21 04:51:40 by donkey