[Lazarus] TBitBtn image, how to make background transparent?
Bo Berglund
bo.berglund at gmail.com
Mon May 13 23:42:23 CEST 2019
On Mon, 13 May 2019 22:41:32 +0200, Ondrej Pokorny via lazarus
<lazarus at lists.lazarus-ide.org> wrote:
>On 13.05.2019 22:36, Bo Berglund via lazarus wrote:
>> I am trying to make a bitmap image for a TBitBtn button such that the
>> background of the image will be transpoarent and therefore the button
>> color will be visible.
>
>What OS and WidgetSet? If you are on win32 - AFAIR a PNG works just fine.
>
Windows 7 x64, Lazarus 2.0.0 32 bit, fpc 3.0.4
I have tried creating a png image (24x24 pixels) with a gray
background equal to the shade at the bottom of the TBitBtn.
When I assign this image as the glyph of the TBitBtn I can see the
image square against the button since the button's gray color is
whiting out towards the top.
So my gray shade is not transparent...
----- BUT WAIT A MINUTE! -------
Even as the button appears with the colored square inside the Lazarus
IDE the background actually disappears (becomes transparent) when I
compile the application and run it!
So it seems like the form is displaying the button in a different way
in the IDE from when the program is running.
I did not know this and I had a number of other items I was coding on
so I did not test it actually running, believing that what I see in
the IDE is what I get when running.
Issue resolved.
--
Bo Berglund
Developer in Sweden
More information about the lazarus
mailing list