|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.|
In Windows 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 CreateRectRgnor CreateRectRgnIndirect. 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 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.
|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|
|Move a region a specified number of logical units||OffsetRgn|
|Retrieve data describing a region||GetRegionData|
|Determine if a point is inside a specified region||PtInRegion|
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.
|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 CE does not support the InvertRgnor InvertRectfunctions. You can achieve the effect of InvertRectby calling the PatBltfunction with an ROP code of DSTINVERT.
Last updated on Tuesday, May 18, 2004