[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 1977

`type TGraphicControl = class(TControl)`
``
`class procedure WSRegisterClass; override;` |  | WSRegisterClass - Register this Class for the current Widget Set
`protected`
`procedure FontChanged(); override;` |  | FontChanged - method for dealing with a changed font
`procedure Paint; virtual;` |  | Virtual Paint method called in response to paint requests.
`procedure DoOnChangeBounds; override;` |  | Calls the OnChangeBounds event handler
`procedure DoOnParentHandleDestruction; override;`
`procedure Update; override;`
`property OnPaint: TNotifyEvent; [rw]` |  | OnPaint - event handler for request to paint canvas
`public`
`constructor Create(); override;` |  | Create - constructor for TGraphicControl: performs inherited Create then creates local Canvas
`destructor Destroy; override;` |  | Destroy - destructor for TGraphicControl: frees local canvas and performs inherited Destroy
`property Canvas: TCanvas; [r]` |  | A clipping window to the parent canvas.
`end;`

## Inheritance

`TGraphicControl` |  | TGraphicControl is the base class for all lightweight controls.
`TControl`
`TLCLComponent` |  | TLCLComponent - base class for LCL components
`TComponent,IUnknown,IInterfaceComponentReference`
`TPersistent`
`TObject`

## Description

TGraphicControl supports simple lightweight controls that do not need the ability to accept keyboard input or contain other controls.

Since lightweight controls do not wrap GUI screen objects, they are faster and use fewer resources than controls based on TWinControl.

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

## See also

#lcl.Controls.TWinControl
#lcl.Graphics.TCanvas |  | TCanvas - where most of the drawing is performed

The latest version of this document can be found at lazarus-ccr.sourceforge.net.