Region Creation and Selection

An application creates a region by calling a function associated with a specific shape. The following table shows the function(s) associated with each of the standard shapes.

Shape Function
Rectangular region CreateRectRgn, CreateRectRgnIndirect, SetRectRgn
Rectangular region with rounded corners CreateRoundRectRgn
Elliptical region CreateEllipticRgn, CreateEllipticRgnIndirect
Polygonal region CreatePolygonRgn, CreatePolyPolygonRgn

Each region creation function 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. After a region is selected into a device context, the application can perform various operations on it.