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

You can use clipping regions to restrict your output to a specified subregion of the client area. To use a clipping region, you must select it into the device context associated with the display device.

Clipping is used in Windows Embedded CE in a variety of ways. Word processing and spreadsheet applications clip keyboard input to keep it from appearing in the margins of a page or spreadsheet. Computer-aided design and drawing applications clip graphics output to keep it from overwriting the edges of a drawing or picture.

Some device contexts provide a predefined or default clipping region. For example, the device context created by the BeginPaintfunction contains a predefined rectangular clipping region that corresponds to the invalid rectangle to be repainted. However, the device contexts created by the CreateDCand GetDCfunctions contain empty clipping regions; clipping is done only to keep graphics output in the window client area.

You can perform a variety of operations on clipping regions. Some of these operations require a handle identifying the region and some do not. For example, you can perform the following operations directly on a device context clipping region:

  • Determine if part of the client area intersects a region by calling the RectVisiblefunction.

  • Exclude a rectangular part of the client area from the current clipping region by calling the ExcludeClipRectfunction.

  • Combine a rectangular part of the client area with the current clipping region by calling the IntersectClipRectfunction.

After obtaining a handle identifying the clipping region, you can perform any operation common with regions, such as the following operations:

  • Combine a copy of the current clipping region with a second region by calling the CombineRgnfunction.

  • Compare a copy of the current clipping region to a second region by calling the EqualRgnfunction.

  • Determine if a point lies within the interior of a copy of the current clipping region by calling the PtInRegionfunction.

See Also