Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

In Windows Embedded CE, a regionis a rectangle that can be filled, painted, framed, and tested to see if it contains a particular point.

You create a region by calling CreateRectRgn, CreateRectRgnIndirect, or ExtCreateRegion. These functions return a handle identifying the new region. When using the CreateRectRgnand CreateRectRgnIndirectfunctions, use values for regions that can be represented by 16-bit integers because that is how region data is stored in Windows Embedded CE. Once you have a handle to a region, you can select the region into a device context with the SelectObjectfunction.

You can perform a variety of operations on a region. You can paint or invert its interior, draw a frame around it, retrieve its dimensions, and test whether a particular point lies within it. The following table shows what tasks you can perform on regions.

To Call

Determine if two regions are equal in size and shape

EqualRgn

Paint the interior of a region with a specified brush

FillRgn

Retrieve the dimensions of a region's bounding rectangle

GetRgnBox

Retrieve data describing a region

GetRegionData

Invalidate the client area within a specified region by adding the area to the current update region of a window

InvalidateRgn

Move a region a specified number of logical units

OffsetRgn

Determine if a point is inside a specified region

PtInRegion

Validate the client area within a region by removing the region from the current update region of a specified window

ValidateRgn

You can also combine or compare a region with another region by calling the CombineRgnfunction. The following table shows how you can call the CombineRgnfunction to combine two regions together.

Value Description

RGN_AND

The intersecting parts of two original regions define a new region.

RGN_COPY

A copy of the first of the two original regions defines a new region.

RGN_DIFF

The part of the first region that does not intersect the second defines a new region.

RGN_OR

The two original regions define a new region.

RGN_XOR

Those parts of the two original regions that do not overlap define a new region.

Windows Embedded CE does not support the InvertRgnor InvertRectfunctions. You can achieve the effect of InvertRectby calling the PatBltfunction with an ROP code of DSTINVERT.

When the display is changed from a left-to-right orientation to a right-to-left orientation, the origin of a region's coordinate system flips along with the region.

See Also