Sign in Join
FPDoc Onlineexperiment

TCustomImage.Paint procedure

Member of TCustomImageprotectedIn unit ExtCtrls

Draws the image to the control canvas.

Declaration

pascal
procedure Paint; override

Description

Paint is an overridden procedure used to draw the image to the control Canvas. At design-time, a dashed black line is drawn around the image as a frame to mark the dimensions for its content.

Paint uses the Canvas from the ancestor class as the target for the drawing operation. The value in AntialiasingMode is assigned to the corresponding property in the Canvas. The rectangle returned from DestRect is used as the drawing area.

No actions are performed in the method when a TGraphic instance has not been assigned to the Graphic property in Picture, or the ancestor class does not have an assigned Canvas.

Paint signals the OnPaintBackground event handler (when assigned) using the canvas and drawing rectangle to render the background for the image.

If the image is loaded using Images and ImageIndex, the canvas scaling factor is applied (when needed) to the width and height for the bitmap image. The StretchDraw method in the Canvas is used to render the image content to the display rectangle on the canvas.

Paint calls the inherited Paint method to ensure that the OnPaint event handler is signalled (when assigned).

Modified in LCL version 4.4 to perform image scaling (when needed) using the canvas scaling factor for the widgetset.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.