0
votes

Using: Delphi XE2; VCL Forms application

Is it possible to draw transparent GIF images on an ActionToolbar (with ActionManager) using TImageList?

I have been trying but what I get is a black background on the toolbuttons.

The GIF images are 256 colors; and have transparency (verified by opening the images in Corel PaintShopPro).

On the ImageList, I have set the properties:

ColorDepth := cd32bit, DrawingStyle := dsTransparent.

Screen captures of the form at design-time and run-time:

enter image description here

enter image description here

Any tips or workaround is appreciated!

1
Isn't this the bottom-left-pixel thing? delphi.about.com/od/delphitips2007/qt/timage_transp.htm In that case the transparent color is defined differently (pixel vs. palette index), so you'll have to match those.Jan Doggen
cd32bit is wrong, as is dsTransparent. There's no alpha channel here. FWIW, GIF is the wrong format for these images. You want 32bpp with alpha channel.David Heffernan
@JanDoggen: Excellent! This works.Steve F
@DavidHeffernan: Yes. I have corrected to cd8Bit. But not sure about the alpha channel. Where is the property setting for that?Steve F
A GIF does not have an alpha channel. You should stop using GIF if you want to have good transparency.David Heffernan

1 Answers

1
votes

Save your GIF as PNG. The PNG has alpha channel and supports semi transparency