CRgn::CreateRectRgn
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

CRgn::CreateRectRgn

Creates a rectangular region that is stored in the CRgn object.

BOOL CreateRectRgn(
   int x1,
   int y1,
   int x2,
   int y2 
);

Parameters

x1
Specifies the logical x-coordinate of the upper-left corner of the region.
y1
Specifies the logical y-coordinate of the upper-left corner of the region.
x2
Specifies the logical x-coordinate of the lower-right corner of the region.
y2
Specifies the logical y-coordinate of the lower-right corner of the region.

Return Value

Nonzero if the operation succeeded; otherwise 0.

Remarks

The size of a region is limited to 32,767 by 32,767 logical units or 64K of memory, whichever is smaller.

When it has finished using a region created by CreateRectRgn, an application should use the CGDIObject::DeleteObject member function to remove the region.

Example

CRgn   rgn;

BOOL bSucceeded = rgn.CreateRectRgn( 50, 20, 150, 120 );
ASSERT( bSucceeded == TRUE );

For an additional example, see CRgn::CombineRgn.

See Also

CRgn Overview | Class Members | Hierarchy Chart | CRgn::CreateRectRgnIndirect | CRgn::CreateRoundRectRgn | CreateRectRgn

Show:
© 2016 Microsoft