Displaying the Background Image

Delphi User's Guide > A Forms Filler

The background image is displayed by an Image Control. This is not a separate custom control, but a child window of the Text Control. To display the background image, create a Text Control which has the size of the whole page, and then load an image using Text Control's ObjectInsertAsChar method.

The Text Control which displays the background image has an additional function, which again saves a lot of programming work. It acts as a container for the Text Controls which are used as fill-out fields. (A container control enables you to draw other controls within it at design time). The big advantage of a container is that it handles all of the clipping for the controls which have been created on top of it. Otherwise, scrolling the background image would cause the text fields to overwrite anything that lies within the form's boundaries, like ButtonBar, Ruler, and even the scrollbars. It would require many calculations of field positions and sizes and some direct calls to the Windows DLLs on every scroll and resize event to do the clipping without a container control. Using the background Text Control as a container, you need only create the first text field inside of it, and everything else is done automatically.