[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'Controls' (#lcl)

# TWinControl.PaintControls

Paints all child controls which do not have a Handle.

## Declaration

Source position: controls.pp line 2188

`protected procedure TWinControl.PaintControls(`
`DC: HDC;`
`First: TControl`
`);`

## Arguments

`DC` |  | The device context usable for painting child controls.
`First` |  | First of the controls in Controls[], which remain to paint.

## Description

Controls which do not descend from TWinControl have no handle of their own; they are repainted when the parent control is redrawn.

No actions are performed in PaintControls for the following conditions:

- The device context in DC is unassigned (0).
- The device context in DC is a handle for a design-time window.
- The Handle has not been allocated for the control.
- The internal TFPList has not been created to store child controls in the Controls property.

PaintControls tries to locate and paint controls (starting with the control in First) not derived from TWinControl. When First is omitted (Nil) or not found in the internal list, all child controls in the list are examined. The control must be Visible and within the visible client area on the Parent to be painted.

Each eligible control is positioned on the device context using the Left and Top properties for the control. Its clipping rectangle is copied to the device context, and an LM_PAINT message is performed on the DC to redraw the parent control.

The ControlState property is updated prior to and following the paint operation for each child control to include or exclude the csPaintCopy control state value.

PaintControls is called from the PaintHandler method, and occurs when the WMPaint method handles an LM_PAINT message for a control.