ExcludeClipRect

2.x

  int ExcludeClipRect(hdc, nLeftRect, nTopRect, nRightRect, nBottomRect)    
  HDC hdc; /* handle of device context */
  int nLeftRect; /* x-coordinate top-left corner of rectangle */
  int nTopRect; /* y-coordinate top-left corner of rectangle */
  int nRightRect; /* x-coordinate bottom-right corner of rectangle */
  int nBottomRect; /* y-coordinate bottom-right corner of rectangle */

The ExcludeClipRect function creates a new clipping region that consists of the existing clipping region minus the specified rectangle.

Parameters

hdc

Identifies the device context.

nLeftRect

Specifies the logical x-coordinate of the upper-left corner of the rectangle.

nTopRect

Specifies the logical y-coordinate of the upper-left corner of the rectangle.

nRightRect

Specifies the logical x-coordinate of the lower-right corner of the rectangle.

nBottomRect

Specifies the logical y-coordinate of the lower-right corner of the rectangle.

Return Value

The return value is SIMPLEREGION (region has no overlapping borders), COMPLEXREGION (region has overlapping borders), or NULLREGION (region is empty), if the function is successful. Otherwise, the return value is ERROR (no region is created).

Comments

The width of the rectangle, specified by the absolute value of nRightRectnLeftRect, must not exceed 32,767 units. This limit applies to the height of the rectangle as well.

Example

The following example uses the ExcludeClipRect function to create a clipping region in the shape of a frame that is 20 units wide. The frame is painted red when the FillRect function is used to paint the client area.

RECT rc;
HRGN hrgn;
HBRUSH hbrRed;

GetClientRect(hwnd, &rc);
hrgn = CreateRectRgn(10, 10, 110, 110);
SelectClipRgn(hdc, hrgn);

ExcludeClipRect(hdc, 30, 30, 90, 90);

hbrRed = CreateSolidBrush(RGB(255, 0, 0));
FillRect(hdc, &rc, hbrRed);

DeleteObject(hbrRed);
DeleteObject(hrgn);

See Also

CombineRgn