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

# TGraphicControl

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

TGraphicControl is the base class for all lightweight controls.

## Declaration

Source position: controls.pp line 2446

`type TGraphicControl = class(TControl)`
`protected`
`class procedure WSRegisterClass; override;` |  | Registers this component class with the current WidgetSet.
`procedure FontChanged(); override;` |  | Performs actions needed when the Font for the control has been changed.
`procedure Paint; virtual;` |  | Implements the default handler used to draw the control.
`procedure DoOnChangeBounds; override;` |  | Performs action needed when the bounds for the control have been changed.
`procedure DoOnParentHandleDestruction; override;` |  | Performs actions when the handle for the parent control is freed.
`property OnPaint: TNotifyEvent; [rw]` |  | Event handler signalled to paint the control.
`procedure CMCursorChanged(); message;` |  | Handles the CM_CURSORCHANGED message for the control.
`public`
`constructor Create(); override;` |  | Constructor for the class instance.
`destructor Destroy; override;` |  | Destructor for the class instance.
`property Canvas: TCanvas; [r]` |  | A clipped window into the parent Canvas.
`end;`

## Inheritance

`TGraphicControl` |  | TGraphicControl is the base class for all lightweight controls.
`TControl` |  | The base class for visible controls.
`TLCLComponent` |  | The base class for LCL components which have an associated widget.
`TComponent`
?
`TObject`

## Description

TGraphicControl supports simple lightweight controls that do not need the ability to accept keyboard input, and do not contain other controls. Since lightweight controls do not wrap GUI widgets, they use fewer resources than controls based on TWinControl. If you want to accept keyboard input, or need to support child controls, use a TCustomControl instead.

TGraphicControl provides a Canvas property for access to the control's drawing surface and a virtual Paint method and an OnPaint handler, called in response to paint requests received by the parent control.

Override the Paint method, or supply your own OnPaint handler, to do the actual drawing of the control.

## See also

TCustomControl |  | The base class for windowed controls which paint themselves.
TGraphicControl.Paint |  | Implements the default handler used to draw the control.
TGraphicControl.OnPaint |  | Event handler signalled to paint the control.
TCanvas |  | Implements a drawing surface for a visual control or bitmap image.