Discussion:
Transparent Icons appear with a white background
(too old to reply)
Tony
2008-01-03 10:50:12 UTC
Permalink
Hi,

I have got a CToolbar and an associated image list, and I have set the
background of my icons to be the Visual Studio default transparent colour
(salmon or whatever it is), yet my icons appear on the toolbar with white
backgrounds.

I am assuming that I do not need to do anything with the Toolbar to set a
transparency colour - is this correct?

Can anyone please tell me where am I going wrong with the transparency
settings for the icon backgrounds.

Regards

Tony
Serge Wautier
2008-01-03 13:07:20 UTC
Permalink
It depends on the graphics format you use.
If your images are icons, then transparency is handled in the icon itself
and you should take care of it when designing the icons (I mean in the icons
editor).
If your images are bitmaps (with no alpha channel), then you must specify
which color is a placeholder for transparent in the code that loads the
bitmap.

HTH,

Serge.
http://www.apptranslator.com - Localization tool for your MFC applications
Post by Tony
Hi,
I have got a CToolbar and an associated image list, and I have set the
background of my icons to be the Visual Studio default transparent colour
(salmon or whatever it is), yet my icons appear on the toolbar with white
backgrounds.
I am assuming that I do not need to do anything with the Toolbar to set a
transparency colour - is this correct?
Can anyone please tell me where am I going wrong with the transparency
settings for the icon backgrounds.
Regards
Tony
David Ching
2008-01-03 13:24:10 UTC
Permalink
Post by Tony
Hi,
I have got a CToolbar and an associated image list, and I have set the
background of my icons to be the Visual Studio default transparent colour
(salmon or whatever it is), yet my icons appear on the toolbar with white
backgrounds.
I am assuming that I do not need to do anything with the Toolbar to set a
transparency colour - is this correct?
Can anyone please tell me where am I going wrong with the transparency
settings for the icon backgrounds.
If you look at the .ico files in Explorer, does Explorer show them as
transparent (non-white backgrounds)? If so, perhaps the code to create your
image list doesn't set the ILC_ flags correctly. Could you show that code?

Thanks,
David
Joseph M. Newcomer
2008-01-03 17:37:54 UTC
Permalink
I have no idea what color "salmon" is, but the typical background for a transparent pixel
in an icon is a funky green color, which is chosen by picking not one of the colors but by
using the funny-looking "screen color" icon.

A bitmap used for a toolbar is a different case; icons are not involved at all. You are
creating and editing a BITMAP, not an ICON. Typically, you would use the gray
(192,192,192) background, because the bitmap is apparently loaded with the LR_MAP3DCOLORS
option, which will change the 192,192,192 value to whatever the background color is for
the current color scheme. If you choose the same funny green color that is used for
editing icons, you will not see transparency.

It is important that if you use the phrase "icon" you are referring only to ICON objects.
An image list is *not* a list of ICON objects, it is a BITMAP object. Note that if you
are creating an image list yourself, you get to specify which color is transparent; there
is no "default" color. CImageList::Create allows you to specify which color you have
chosen to be "transparent".
joe
Post by Tony
Hi,
I have got a CToolbar and an associated image list, and I have set the
background of my icons to be the Visual Studio default transparent colour
(salmon or whatever it is), yet my icons appear on the toolbar with white
backgrounds.
I am assuming that I do not need to do anything with the Toolbar to set a
transparency colour - is this correct?
Can anyone please tell me where am I going wrong with the transparency
settings for the icon backgrounds.
Regards
Tony
Joseph M. Newcomer [MVP]
email: ***@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

Loading...