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

# TCustomControl

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

The base class for windowed controls which paint themselves.

## Declaration

Source position: controls.pp line 2468

`type TCustomControl = class(TWinControl)`
`protected`
`class procedure WSRegisterClass; override;` |  | Registers this component class with the current WidgetSet.
`procedure WMPaint(); message;` |  | Handles LM_PAINT messages for the control.
`procedure DestroyWnd; override;` |  | Destroys the handle for the Canvas and the interface object.
`procedure PaintWindow(); override;` |  | The Paint handler plug-in, intercepting paint requests.
`procedure FontChanged(); override;` |  | Performs actions needed when the Font for the control has been changed.
`procedure SetColor(); override;` |  | Sets the value for the Color property
`procedure Paint; virtual;` |  | Implements the default handler used to draw the control.
`public`
`constructor Create(); override;` |  | Constructor for the class instance.
`destructor Destroy; override;` |  | Destructor for the class instance.
`property Canvas: TCanvas; [rw]` |  | The drawing surface for the control.
`property BorderStyle: TBorderStyle;` |  | Indicates the border style displayed around the control.
`property OnPaint: TNotifyEvent; [rw]` |  | Event handler signalled to paint the control.
`end;`

## Inheritance

`TCustomControl` |  | The base class for windowed controls which paint themselves.
`TWinControl` |  | Implements a windowed control which can contain other child controls.
`TControl` |  | The base class for visible controls.
`TLCLComponent` |  | The base class for LCL components which have an associated widget.
`TComponent`
?
`TObject`

## Description

In contrast to TGraphicControl, a TCustomControl can accept keyboard input (and receive Focus), and can have child controls. It is used as the base class for many of the controls in the LCL.

TCustomControl provides overridden methods which handle messages, update control state flags, and update the Canvas where the control is drawn.

Override the Paint method, or supply your own OnPaint handler, to perform the actual drawing operations for the control.

## See also

TGraphicControl |  | TGraphicControl is the base class for all lightweight controls.
TWinControl |  | Implements a windowed control which can contain other child controls.