简体   繁体   中英

How to create a non-rectangular button with Delphi?

如何用Delphi创建透明的非矩形按钮?

Basically you use SetWindowRgn to define the shape of your button/control/window. See here for an example.

Or if you don't mind that your button can't be selected by the keyboard you could also use a TImage and use the OnMouseUp event.

Or find a 3rd party button that already does what you want on Torry .

Raize Components有一个名为TRzShapeButton的组件,但也可能有免费的替代品。

You could use SetWindowRgn only if you didn't mind it looking quite odd - the bits that fall outside the region will simply be gone. Your best bet is probably deriving from TCustomTransparentControl, but you'd then need to do custom painting. I suspect though, that custom painting was what you expected all along?

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