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

# TCanvas.CopyRect

Copies the rectangle found at Source in SrcCanvas to the destination position in Dest.

## Declaration

Source position: graphics.pp line 1111

`public procedure TCanvas.CopyRect(`
`const Dest: TRect;`
`SrcCanvas: TCanvas;`
`const Source: TRect`
`); virtual;`

## Arguments

`Dest` |  | TRect instance with the bounds where the copied values are stored on the canvas.
`SrcCanvas` |  | TCanvas instance with the value copied in the method.
`Source` |  | TRect instance with the content copied in the method.

## Description

CopyRect is a method used to copy a rectangular area from another TCanvas instance to the specified location on the canvas instance.

No actions are performed in the method if SrcCanvas has not been assigned, or when the width or height in either Source or Dest is zero (0) pixels.

CopyRect calls the StretchBlt routine in the LCL interface to expand or shrink the content in Source to the dimensions in Dest. The CopyMode property provides the raster operation for the block transfer.

CopyRect calls Changing to signal an assigned OnChanging event handler prior to the block transfer. CopyRect calls Changed to signal an assigned OnChange event handler immediately after to the block transfer.

## See also

TCanvas.CopyMode |  | Indicates the raster operation used to combine pixel colors on the drawing surface.
TCanvas.Changing |  | Signals the OnChanging event handler (when assigned).
TCanvas.Changed |  | Signals the OnChange event handler (when assigned).