I'm using Delphi 2007. How can I put a GIF/PNG image on a BitBtn component? (Preferably, with alpha transparency supported)
+2
A:
Use a graphics program like Photoshop (or something less expensive) to convert the images to bitmaps. BitBtns don't accept GIF or PNG images.
Kluge
2008-10-26 22:49:11
But then transparency becomes an issue.
delphist
2008-10-26 22:50:51
From memory, Delphi had a little trick where it considered one of the corner pixels (top-left? bottom-left?) to be the "transparent" colour. Provided you leave that pixel as the colour you want to be transparent it should work, even for BMPs.
Matt Hamilton
2008-10-26 23:16:27
It's the bottom left pixel, but it's colour-key transparency only. If you want alpha-blended transparency, you need to use PNG in Delphi 2009.
Tim Knipe
2008-10-27 00:24:43
For conversion, you can use Paint.NET or IrfanView. Both are free.
gabr
2008-10-27 07:41:31
Weird - I see a lot of replies talking about alpha transparency, but I didn't get that from his question. He mentions GIF too - does GIF have an alpha channel? I don't remember.
Matt Hamilton
2008-10-27 07:48:19
+3
A:
PngComponents pack has a component named PngBitBtn wich can display correctly PNG's with alpha transparency. They are somewhat old, but they can be installed under Delphi 2007 with a little work.
atika
2008-10-27 05:15:33
A:
PNGimage, which is included in Delphi 2009k, should do the job. If we can find it.
Henrik R Clausen
2010-03-21 10:11:21