Question

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)?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top