Working with Transparent Text Controls

Delphi User's Guide > A Forms Filler

Run the program, load a background image and create a few text fields by clicking on this background image. You will notice that the text fields are transparent, so you can see the background image below. Using this feature in a program requires some fine-tuning of the clipping areas with the ClipChildren and ClipSiblings properties.

These two properties determine which areas of an image are repainted when a new part of a control becomes visible or when its contents have been changed. For example, if one control is covered by another, it only has to be repainted if the one which lies on top of it is transparent. You will always want to repaint as little as possible to make the application run fast and to avoid unnecessary flickering on the screen. Furthermore you will not want your computer to spend time drawing things which are not visible.

For maximum flexibility in setting the clipping areas and mixing transparent and opaque controls, two properties have been implemented which share this task:

The ClipChildren property is used only for Text Controls which act as a container for other Text Controls. When ClipChildren is set to True, the areas occupied by the child controls are excluded from the update area. So, if as in the forms filler program, transparent controls are used as children of the container control, this property must be set to False.

The ClipSiblings property determines the behaviour between each of the child controls. It must be set to False if the program allows transparent Text Controls to overlap others.