CRgn::CombineRgn

Syntax

int CombineRgn( CRgn* pRgn1, CRgn* pRgn2, int nCombineMode );

Parameters

pRgn1

Identifies an existing region.

pRgn2

Identifies an existing region.

nCombineMode

Specifies the operation to be performed when combining the two source regions. It can be any one of the following values:

Value Meaning

RGN_AND Uses overlapping areas of both regions (intersection).
RGN_COPY Creates a copy of region 1 (identified by pRgn1).
RGN_DIFF Creates a region consisting of the areas of region 1 (identified by pRgn1) that are not part of region 2 (identified by pRgn2).
RGN_OR Combines both regions in their entirety (union).
RGN_XOR Combines both regions but removes overlapping areas.

Remarks

Creates a new GDI region by combining two existing regions. The regions are combined as specified by nCombineMode.

The two specified regions are combined, and the resulting region handle is stored in the CRgn object. Thus, whatever region is stored in the CRgn object is replaced by the combined region.

Note:

Use CopyRgn to simply copy one region into another region.

Return Value

Specifies the type of the resulting region. It can be one of the following values:

Value Meaning

COMPLEXREGION New region has overlapping borders.
ERROR No new region created.
NULLREGION New region is empty.
SIMPLEREGION New region has no overlapping borders.

See Also

CRgn::CopyRgn, ::CombineRgn