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

# TRegion.AddRectangle

Convenience routine to add a rectangle to the region.

## Declaration

Source position: graphics.pp line 782

`public procedure TRegion.AddRectangle(`
`X1: Integer;`
`Y1: Integer;`
`X2: Integer;`
`Y2: Integer`
`);`

## Arguments

`X1` |  | Horizontal coordinate for one corner of the rectangular area.
`Y1` |  | Vertical coordinate for one corner of the rectangular area.
`X2` |  | Horizontal coordinate for the opposing corner of the rectangular area.
`Y2` |  | Vertical coordinate for the opposing corner of the rectangular area.

## Description

Gets a handle for the rectangular defined by the opposing corners with the X1, Y1, X2, and Y2 coordinates. The new region handle is OR-ed with the existing handle for the region.

Calls ReferenceNeeded to ensure that the handle for the region has been allocated.

Discards the new region handle by calling DeleteObject.