From RAD Studio API Documentation
Jump to: navigation, search


property OnPaint: TNotifyEvent read FOnPaint write FOnPaint;


__property System::Classes::TNotifyEvent OnPaint = {read=FOnPaint, write=FOnPaint};


Type Visibility Source Unit Parent
event published
Vcl.ExtCtrls TPaintBox


OnPaint occurs when the paintbox receives a Windows paint message.

Write an OnPaint event handler to draw the image of the paint box. The OnPaint event fires when the system repaints the TPaintBox control. If there is a handler for this event, its code is executed when the OnPaint event fires.

Use properties and methods of the canvas (such as LineTo, Draw, and TextOut) to programmatically construct the image that the paintbox presents on a form. This can consist of a number of operations including drawing lines, images, and shapes. A TPaintBox itself has no visible manifestation, so if an OnPaint event handler is not provided or no drawing is done in the event handler, the paintbox cannot be seen on the form at run time.

See Also

Code Examples