[Overview][Types][Classes][Procedures and functions][Index] | Reference for unit 'ImgList' (#lcl)

# TCustomImageList.StretchDraw

Draws an image stretched to the dimensions for the target rectangle.

## Declaration

Source position: imglist.pp line 393

`public procedure TCustomImageList.StretchDraw(`
`Canvas: TCanvas;`
`Index: Integer;`
`ARect: TRect;`
`Enabled: Boolean = True`
`);`

## Arguments

`Canvas` |  | Canvas used for the drawing operation.
`Index` |  | Ordinal position for the image drawn in the method.
`ARect` |  | Rectangle coordinates used for the draw operation.
`Enabled` |  | Indicates if the image is drawn using the enabled display state.

## Description

StretchDraw is a procedure used to render an image stretched to the required dimensions on the specified canvas.

Canvas is the TCanvas instance where the image is rendered using the dimensions in the target rectangle.

Index contains the ordinal position for the image drawn in the method.

ARect is a TRect instance that contains the Top, Left, Bottom, and Right coordinates for the canvas. The rendered image must fit with in these boundaries on the canvas.

Enabled indicates if the image is drawn using its "enabled" state. When Enabled is True, the gdeEnabled drawing effect is used for the rendered image. When Enabled is False, the gdeDisabled drawing effect is used.

StretchDraw searches the images resolutions in the image list to locate the best scaling candidate for the width represented in ARect. If a suitable TCustomImageListResolution is located for the operation, its StretchDraw method is called using the parameter values as arguments. No actions are performed in the method if a suitable scaling candidate resolution is not found.

## See also

TCustomImageListResolutions.FindBestToScaleFrom |  | Finds the image resolution with the best size for scaling to the target width.
TCustomImageListResolution.StretchDraw |  | Draws an image stretched to the dimensions for the target rectangle.