Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CreateRectRgn function

The CreateRectRgn function creates a rectangular region.

Syntax


HRGN CreateRectRgn(
  _In_ int nLeftRect,
  _In_ int nTopRect,
  _In_ int nRightRect,
  _In_ int nBottomRect
);

Parameters

nLeftRect [in]

Specifies the x-coordinate of the upper-left corner of the region in logical units.

nTopRect [in]

Specifies the y-coordinate of the upper-left corner of the region in logical units.

nRightRect [in]

Specifies the x-coordinate of the lower-right corner of the region in logical units.

nBottomRect [in]

Specifies the y-coordinate of the lower-right corner of the region in logical units.

Return value

If the function succeeds, the return value is the handle to the region.

If the function fails, the return value is NULL.

Remarks

When you no longer need the HRGN object, call the DeleteObject function to delete it.

Region coordinates are represented as 27-bit signed integers.

Regions created by the Create<shape>Rgn methods (such as CreateRectRgn and CreatePolygonRgn) only include the interior of the shape; the shape's outline is excluded from the region. This means that any point on a line between two sequential vertices is not included in the region. If you were to call PtInRegion for such a point, it would return zero as the result.

Examples

For an example, see Drawing Markers.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Wingdi.h (include Windows.h)

Library

Gdi32.lib

DLL

Gdi32.dll

See also

Regions Overview
Region Functions
CreatePolygonRgn
CreatePolyPolygonRgn
CreateRectRgnIndirect
CreateRoundRectRgn
ExtCreateRegion
GetRegionData
DeleteObject
SelectObject

 

 

Show: