Share via


CDC::SelectClipRgn

This method selects the specified region as the clipping region for the device context.

int SelectClipRgn(
CRgn* pRgn );

int SelectClipRgn(
CRgn* pRgn,
int nMode ); 

Parameters

  • pRgn
    Identifies the region to select.
    • For the first version of this function, if this value is NULL, the entire client area is selected and output is clipped to the window.
    • For the second version of this function, this handle can be NULL only when the RGN_COPY mode is specified.
  • nMode
    The operation to perform. It must be one of the following values:
    • RGN_AND   The new clipping region combines the overlapping areas of the clipping region and the region identified by pRgn.
    • RGN_COPY   The new clipping region is a copy of the region identified by pRgn. This functionality is identical to the first version of SelectClipRgn. If the region identified by pRgn is NULL, the new clipping region becomes the default clipping region, a null region.
    • RGN_DIFF   The new clipping region combines the areas of the current clipping region with those areas excluded from the region identified by pRgn.
    • RGN_OR   The new clipping region combines the current clipping region and the region identified by pRgn.
    • RGN_XOR   The new clipping region combines the current clipping region and the region identified by pRgn but excludes any overlapping areas.

Return Value

The type of the region. It can be any of the following values:

  • COMPLEXREGION
    New clipping region has overlapping borders.
  • ERROR
    Device context or region is not valid.
  • NULLREGION
    New clipping region is empty.
  • SIMPLEREGION
    New clipping region has no overlapping borders.

Remarks

Only a copy of the selected region is used. The region itself can be selected for any number of other device contexts, or it can be deleted.

This method assumes that the coordinates for the given region are specified in device units. Some printer devices support text output at a higher resolution than graphics output in order to retain the precision needed to express text metrics. These devices report device units at the higher resolution, that is, in text units. These devices then scale coordinates for graphics so that several reported device units map to only one graphic unit. You should always call the SelectClipRgn function using text units.

Requirements

**  Windows CE versions:** 1.0 and later
  Header file: Declared in Afxwin.h
  Platform: H/PC Pro, Palm-size PC, Pocket PC

See Also

CDC::GetClipBox, CRgn