简体   繁体   中英

How make a firemonkey button with transparent graphic, and make it the default style

With firemonkey I'm lost in how do some basic stuff.

I already know that I need to put a TImageControl inside the TButton to show a image.

However, the TImageControl is show with a border and a white background. I load inside a ico and/or png and wanna show it transparent, and wanna this for the whole app.

What are the steps for do this?

Try TImage instead of TImageControl . TImage is transparent by default. Of course, if your image isn't rectangular, you'll want to load an image that supports alpha channel, such as a PNG image.

If you insist on a TImageControl, right-click on it, select "Edit Custom Style..." and on the background TRectangle, set it's Fill color from claWhite to claNull and click Apply and Close . For any additional TImageControl, set its StyleLookup property to the same.

You'll also want to turn off the HitTest property of the image control.

My TBitmapSpeedButton component may provide a ready rolled solution for what you're trying to achieve. If not, the blog post about how I created it will almost certainly help.

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