Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Opacity of a TWinControl?

How could one change the opacity of a TWinControl based control? And why didn't they add this capability to TControl/TWinControl level (why only TForm)?

like image 560
utku_karatas Avatar asked Nov 21 '25 02:11

utku_karatas


2 Answers

Controlling the opacity of a window is offered by a feature called layered windows. You can read more about the feature on MSDN. The feature is only available for top-level windows. As far as I can tell, Desktop Window Manager (Vista's "glass" effect) is also only available for top-level windows.

Alternatives available for child windows are to use window regions to mark certain areas of a window as completely transparent, or to use bitmap alpha blending to draw the whole control yourself.

like image 141
Rob Kennedy Avatar answered Nov 22 '25 17:11

Rob Kennedy


Thanks Lars.

I don't how you'd do it. As I understand it, Windows only added the translucency to windows, which is why TForm can handle it, but not individual controls. Remember that most of the VCL is simply a wrapper around the Windows Common Controls, and so if Windows doesn't do it, the related VCL control rarely will either. Third-party components often then extend the basic functionality.

like image 35
J__ Avatar answered Nov 22 '25 17:11

J__



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!