简体   繁体   中英

Delphi XE7 - Make PNG image transparent inside Form

I set the Form Color to : clFichsia and TransparentColor: True and TransparentColorValue to : clFuchsia. I need to remove the clFuchsia color from the Form. Normally the image is transparent but when i load it in the application the color of the Form doesn't disappear.

How my application looks like: http://i.imgur.com/ivtm6ld.png

There are two different ways to handle transparency:

1) the old simplified (Windows/Delphi) way, where a specific RGB color is made transparent. This method does not allow any partial transparency (opacity is either 0% or 100%).

2) the "new" way, where you use an image with an alpha-channel, eg a PNG image. Each pixel has an opacity value in addition to the RGB value, which allows partial transparency (eg for anti-aliasing).

You are mixing those two methods. You load a PNG image with an alpha channel (method 2), but then you also set a transparent color (method 1). And the reason it looks that bad, is because the "fuchsia" RGB value in your image is not exactly the same everywhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM