I seem to recall Delphi 7 having transparency issues with Image Lists ... in any case Windows GDI does not handle transparency very well.
Also, check that your image list is actually holding a transparent bitmap. Simply loading it from a resource or stream will not preserve the transparency information. Furthermore, TSpeedButton does not play nice with image lists. I use this code because it creates a wide bitmap for the different button states. var Glyph: TBitmap; w: Integer; begin Glyph := SpeedButton.Glyph; Glyph.PixelFormat := pf32bit; // The default is pfDevice which does not support transparency w := ImageList.Width; Glyph.Width := w * 4 {NumberOfImages}; Glyph.Height := ImageList.Width; // Normal image ImageList.Draw (Glyph.Canvas, 0, 0, NormalIndex); // Disabled image ImageList.Draw (Glyph.Canvas, w, 0, DisabledIndex); // Clicked image ImageList.Draw (Glyph.Canvas, w * 2, 0, ClickedIndex); // Down image ImageList.Draw (Glyph.Canvas, w * 3, 0, DownIndex); end; Regards, Dennis. -----Original Message----- From: Ross Levis Sent: Friday, October 30, 2015 3:51 PM To: 'NZ Borland Developers Group - Delphi List' Subject: [DUG] Assigned image to SpeedButton not transparent Using D7/themes, I have a TSpeedButton which is a toggle and I need to display 2 different glyphs in a TSpeedButton based on whether the button was clicked or right-clicked, as they do 2 slightly different things. So I need to assign a glyph to the button at run time, which works, but nothing I do makes the image transparent. There is always a white square with the icon in the middle. It only looks correct if I assign one of the images to the Glyph property at design time. I use a TImageList to store the 2 images, and assign them like this as required. BitMap := TBitMap.Create; ImageList.GetBitmap(n,BitMap); SpeedButton.Glyph := BitMap; BitMap.Free; where n is 0 or 1. I've tried setting Bitmap.Transparent to true and other combinations like TransparentMode and TransparentColor but nothing makes any difference. There is some sort of transparency happening since the images have quite a colorful background but this appears as white on the button. As a test I assigned the image from a filename Button.Glyph.LoadFromFile() and this works correctly and looks good, but I don't want to distribute BMP files separately. A possible alternative I haven’t tried is embedding the 2 images as a resource in the EXE file and using Button.Glyph.LoadFromResourceName (or ResourceID), but that seems a lot of work. I thought I would try here to see if anyone knows how to resolve the current method. Cheers, Ross. _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@listserver.123.net.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@listserver.123.net.nz with Subject: unsubscribe _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@listserver.123.net.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@listserver.123.net.nz with Subject: unsubscribe