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 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 BeginPaint function contains a predefined rectangular clipping region that corresponds to the invalid rectangle to be repainted. However, the device contexts created by the CreateDC and GetDC functions 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:
After obtaining a handle identifying the clipping region, you can perform any operation common with regions, such as the following operations: