Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TImageList.getBitmap vs Transparent Color...

Status
Not open for further replies.

rcloutie

Programmer
May 26, 2005
164
CA
Hi there,

Trying to display a bitmap from within a TImageList to a BitBtn (or TImage). All works fine but one thing: the transparent color is replaced with white color instead of being transparent.

Here's my code:
--------------------------------------------------
var pic: TBitmap;
begin
pic := TBitmap.Create;
img.GetBitmap(1, pic);
// Following lines doesn't change anything...
with pic do
begin
Transparent := True;
TransParentColor := clFuchsia;
TransparentMode := tmAuto;
end;
btn.Glyph := pic;
pic.Free;
end;
--------------------------------------------------

Any ideas?

Thanks in advance for reply,

Rej Cloutier
 
I should have checked this first, but there is something about the bottom left pixel in an image controlling the transparent colour. if its not the colour you have set as transparant then it wont work. [This might just apply to icons]



Steve: Delphi a feersum engin indeed.
 
Bottom Left pixel is clFuchsia (my transparent color).
And the color is replaced with clWhite instead of clBtnFace.

As I said, when affecting an ImageIndex at design time it works well but doing the same at run time, it fails.

 
The problem seems to appear only on my machine.
I have tried my app on another machine and transparent color is honored. Probably depending on hardware (video)...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top