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

# TCustomControl.PaintWindow

The Paint handler plug-in, intercepting paint requests.

## Declaration

Source position: controls.pp line 2476

`protected procedure TCustomControl.PaintWindow(`
`DC: HDC`
`); override;`

## Arguments

`DC` |  | The Device Context used to draw on the Canvas.

## Description

PaintWindow is an overridden method in TCustomControl. It ensures that Canvas has an allocated Handle which matches the device context specified in the DC argument. If the Canvas handle does not match DC, the value in the argument is assigned to Canvas.

PaintWindow calls the Paint method to signal the OnPaint event handler (when assigned).

If Handle value in Canvas was changed in the method, it is reset to 0 (unassigned) prior to exit.

PaintWindow does not call the inherited method.

## See also

TCustomControl.Canvas |  | The drawing surface for the control.
TCustomControl.Paint |  | Implements the default handler used to draw the control.
TCustomControl.OnPaint |  | Event handler signalled to paint the control.
TWinControl.PaintWindow |  | Paints a clipping region for the control on the specified device context.