66.1.1 Region Creation and Selection

An application creates a rectangular region by calling the CreateRectRgn or the CreateRectRgnIndirect functions. An application creates a rectangular region with rounded corners by calling the CreateRoundRectRgn function. An application creates an elliptic region by calling the CreateEllipticRgn or CreateEllipticRgnIndirect functions. An application creates a polygonal region by calling the CreatePolygonRgn or the CreatePolygonRgnIndirect functions. The following illustration shows three types of regions that have been filled and framed:

Three Types of Regions

Each of the region-creation functions returns a handle that identifies the new region. An application can use this handle to select the region into a device context by calling the SelectObject function and supplying this handle as the second argument. Once a region is selected into a device context, it can be operated on.