IntersectClipRect

Syntax

int IntersectClipRect(hDC,X1,Y1,X2,Y2)

This function creates a new clipping region by forming the intersection of the current region and the rectangle specified by X1, Y1, X2, and Y2. GDI clips all subsequent output to fit within the new boundary.

Parameter Type/Description  

hDC HDC Identifies the device context.  
X1 int Specifies the logical x-coordinate of the upper-left corner of the rectangle.  
Y1 int Specifies the logical y-coordinate of the upper-left corner of the rectangle.  
X2 int Specifies the logical x-coordinate of the lower-right corner of the rectangle.  
Y2 int Specifies the logical y-coordinate of the lower-right corner of the rectangle.  

Return Value

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

Value Meaning  

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

Comments

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