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

# TCanvas.StretchDraw

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

## Declaration

Source position: graphics.pp line 1115

`public procedure TCanvas.StretchDraw(`
`const DestRect: TRect;`
`SrcGraphic: TGraphic`
`); virtual;`

## Arguments

`DestRect` |  | TRect instance where the specified content is drawn on the canvas.
`SrcGraphic` |  | TGraphic instance with the image content drawn in the method.

## Description

StretchDraw is a reintroduced method in TCanvas; it reimplements the inherited method to use the specified TGraphic content in the drawing operation instead of a TFPCustomImage instance.

No actions are performed in the method if SrcGraphic has not been assigned.

DestRect provides the rectangular area on the canvas where the graphic content is drawn. The Draw method in SrcGraphic is called to draw the image content onto the canvas instance. If the dimensions in DestRect differ from the Width or Height in SrcGraphic, the image content is expanded or contracted to fit the destination rectangle. This may causes the aspect ratio for the image content to be changed.

StretchDraw calls Changing to signal an assigned OnChanging event handler immediately before the drawing operation. It calls Changed to signal an assigned OnChange event handler when the drawing operation has been completed.

## See also

TCanvas.Changing |  | Signals the OnChanging event handler (when assigned).
TCanvas.Changed |  | Signals the OnChange event handler (when assigned).
TGraphic.Draw |  | Method used to draw the Graphic on the specified Canvas, in the specified Rectangle.
TRect