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

# TWinControl.PaintHandler

Handler for TLMPaint, manages the painting of child controls.

## Declaration

Source position: controls.pp line 2189

`protected procedure TWinControl.PaintHandler(`
`var TheMessage: TLMPaint`
`);`

## Arguments

`TheMessage` |  | LM_PAINT window message handled in the method.

## Description

PaintHandler is a method used to apply the LM_PAINT window message in TheMessage to the client rectangle for the control. The device context in TheMessage is used as the target for the paint operation. If the device context is unassigned on entry, the BeginPaint routine in the LCL interface is called to get a device context for the Handle in the control.

PaintHandler checks the list of child controls if any of the items are visible, opaque TControl class instances which need to be drawn using the Handle for the control. When found, a clipping rectangle for the child control is calculated on the device context.

PaintHandler calls the PaintSite method in the DockManager (when assigned and enabled) to paint the DockSite to the device context. The PaintControls method is called to force the all child controls to be painted to the device context.

PaintHandler calls the EndPaint routine in the LCL interface to free the device context prior to exiting from the method.

PaintHandler is called when the WMPaint method receives an LM_PAINT message for the control.