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

# TCustomImageListResolution.StretchDraw

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

## Declaration

Source position: imglist.pp line 167

`public procedure TCustomImageListResolution.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 compares the image size (using the Height and Width properties) to the size of the target rectangle in ARect. When they are the same size, the Draw method is used to render the specified image. When the sizes are different, the StretchDraw method in ACanvas is used to render the image bitmap expanded or contracted to fit within the specified boundaries.

StretchDraw is used in the implementation of the Draw and DrawOverlay methods in TScaledImageListResolution.

## See also

TCustomImageListResolution.Width |  | Width of the images stored in the resolution.
TCustomImageListResolution.Height |  | Height of the images stored in the resolution.
TCustomImageListResolution.GetBitmap |  | Gets the bitmap for an image drawn using the specified drawing effect.
TCustomImageListResolution.Draw |  | Renders an image to the specified canvas.
TScaledImageListResolution.Draw |  | Draws the scaled image to the specified canvas.
TScaledImageListResolution.DrawOverlay |  | Draws an image with an overlay at the specified canvas position.