Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CombineRgn function

The CombineRgn function combines two regions and stores the result in a third region. The two regions are combined according to the specified mode.

Syntax


int CombineRgn(
  _In_  HRGN hrgnDest,
  _In_  HRGN hrgnSrc1,
  _In_  HRGN hrgnSrc2,
  _In_  int fnCombineMode
);

Parameters

hrgnDest [in]

A handle to a new region with dimensions defined by combining two other regions. (This region must exist before CombineRgn is called.)

hrgnSrc1 [in]

A handle to the first of two regions to be combined.

hrgnSrc2 [in]

A handle to the second of two regions to be combined.

fnCombineMode [in]

A mode indicating how the two regions will be combined. This parameter can be one of the following values.

ValueMeaning
RGN_AND

Creates the intersection of the two combined regions.

RGN_COPY

Creates a copy of the region identified by hrgnSrc1.

RGN_DIFF

Combines the parts of hrgnSrc1 that are not part of hrgnSrc2.

RGN_OR

Creates the union of two combined regions.

RGN_XOR

Creates the union of two combined regions except for any overlapping areas.

 

Return value

The return value specifies the type of the resulting region. It can be one of the following values.

Return codeDescription
NULLREGION

The region is empty.

SIMPLEREGION

The region is a single rectangle.

COMPLEXREGION

The region is more than a single rectangle.

ERROR

No region is created.

 

Remarks

The three regions need not be distinct. For example, the hrgnSrc1 parameter can equal the hrgnDest parameter.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Wingdi.h (include Windows.h)

Library

Gdi32.lib

DLL

Gdi32.dll

See also

Regions Overview
Region Functions
CreateEllipticRgn
CreateEllipticRgnIndirect
CreatePolygonRgn
CreatePolyPolygonRgn
CreateRectRgn
CreateRectRgnIndirect
CreateRoundRectRgn

 

 

Community Additions

Show:
© 2015 Microsoft