IntersectClipRect function (wingdi.h)

The IntersectClipRect function creates a new clipping region from the intersection of the current clipping region and the specified rectangle.

Syntax

int IntersectClipRect(
  [in] HDC hdc,
  [in] int left,
  [in] int top,
  [in] int right,
  [in] int bottom
);

Parameters

[in] hdc

A handle to the device context.

[in] left

The x-coordinate, in logical units, of the upper-left corner of the rectangle.

[in] top

The y-coordinate, in logical units, of the upper-left corner of the rectangle.

[in] right

The x-coordinate, in logical units, of the lower-right corner of the rectangle.

[in] bottom

The y-coordinate, in logical units, of the lower-right corner of the rectangle.

Return value

The return value specifies the new clipping region's type and can be one of the following values.

Return code Description
NULLREGION
Region is empty.
SIMPLEREGION
Region is a single rectangle.
COMPLEXREGION
Region is more than one rectangle.
ERROR
An error occurred. (The current clipping region is unaffected.)

Remarks

The lower and right-most edges of the given rectangle are excluded from the clipping region.

If a clipping region does not already exist then the system may apply a default clipping region to the specified HDC. A clipping region is then created from the intersection of that default clipping region and the rectangle specified in the function parameters.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wingdi.h (include Windows.h)
Library Gdi32.lib
DLL Gdi32.dll

See also

Clipping Functions

Clipping Overview

ExcludeClipRect