CreateRectRgn

2.x

  HRGN CreateRectRgn(nLeftRect, nTopRect, nRightRect, nBottomRect)    
  int nLeftRect; /* x-coordinate upper-left corner of region */
  int nTopRect; /* y-coordinate upper-left corner of region */
  int nRightRect; /* x-coordinate lower-right corner of region */
  int nBottomRect; /* y-coordinate lower-right corner of region */

The CreateRectRgn function creates a rectangular region.

Parameters

nLeftRect

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

nTopRect

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

nRightRect

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

nBottomRect

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

Return Value

The return value is the handle of a rectangular region if the function is successful. Otherwise, it is NULL.

Comments

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 remove the region by using the DeleteObject function.

Example

The following example uses the CreateRectRgn function to create a rectangular region, selects the region into a device context, and then uses the PaintRgn function to display the region:

HDC hdc;
HRGN hrgn;

hrgn = CreateRectRgn(10, 10, 110, 110);
SelectObject(hdc, hrgn);
PaintRgn(hdc, hrgn);

See Also

CreateRectRgnIndirect, CreateRoundRectRgn, DeleteObject, PaintRgn