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

TCustomControl.OnPaint

Event handler signalled to paint the control.

Declaration

Source position: controls.pp line 2496

public property TCustomControl.OnPaint : TNotifyEvent
  read FOnPaint
  write FOnPaint;

Description

OnPaint is a TNotifyEvent property with the event handler signalled to draw the control on its Canvas. An object procedure which draws all aspects of the control must be implemented and assigned to the property.

The Sender argument provides access to properties and methods for the control instance. It must be cast to a TCustomControl to access members for the class type.

Use Canvas to render the control in the event handler. The values from Font and Color are already applied to the corresponding properties in Canvas. The BorderStyle property must be applied in code for the handler.

OnPaint is signalled from the Paint method.

Remark: For the macOS Carbon widgetset, drawing on the Canvas outside of the OnPaint event handler is not supported. Drawing directly to a screen device context is also not supported.

See also

TCustomControl.Paint

  

Implements the default handler used to draw the control.

TCustomControl.Canvas

  

The drawing surface for the control.

TControl.Font

  

The font to be used for text display in this control.

TControl.Color

  

The background color for the control.

TWinControl.BorderStyle

  

Indicates the border style displayed around the control.


Version 3.2 Generated 2024-02-25 Home