Unit 'ExtCtrls' Package
[Overview][Types][Classes][Procedures and functions][Index] [#lcl]

TCustomImage.Paint

Draws the image to the control canvas.

Declaration

Source position: extctrls.pp line 570

protected procedure TCustomImage.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.

Remark: 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).

Version info

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

See also

TCustomImage.Canvas

  

Canvas used to draw the image.

TCustomImage.DestRect

  

Gets the rectangle where the image is painted.

TCustomImage.AntialiasingMode

  

Indicates if anti-aliasing is used when rendering the image.

TCustomImage.Transparent

  

Indicates if the image has a clear, non-opaque background.

TCustomImage.Stretch

  

Indicates if the image is resized to the client area for the control.

TCustomImage.Images

TCustomImage.ImageIndex

TCustomImage.ImageWidth

TCustomImage.OnPaintBackground

  

Event handler signalled to draw the background for the image.

TCanvas

  

Implements a drawing surface for a visual control or bitmap image.

TCanvas.StretchDraw

  

Expands or contracts the specific graphic content to fit the specified destination rectangle on the canvas.

TGraphicControl.Paint

  

Implements the default handler used to draw the control.

TGraphicControl.OnPaint

  

Event handler signalled to paint the control.


Version 4.4 Generated 2025-11-08 Home