User32SubtractRect Method

Overload List

SubtractRect(NativeRectangle, NativeRectangle, NativeRectangle) Determines the coordinates of a NativeRectangle formed by subtracting one NativeRectangle from another.

The function only subtracts the NativeRectangle specified by refSrcRect2 from the NativeRectangle specified by refSrcRect1 when the rectangles intersect completely in either the x- or y- direction.

For example, if refSrcRect1 has the coordinates {10, 10, 100, 100} and refSrcRect2 has the coordinates {50, 50, 150, 150}, the function sets the coordinates of the NativeRectangle pointed to by refDstRect to {10, 10, 100, 100}.

If refSrcRect1 has the coordinates {10, 10, 100, 100} and refSrcRect2 has the coordinates {50, 10, 150, 150}, however, the function sets the coordinates of the NativeRectangle pointed to by refDstRect to {10, 10, 50, 100}.

In other words, the resulting NativeRectangle is the bounding box of the geometric difference.

SubtractRect(Rectangle, Rectangle, Rectangle) Determines the coordinates of a Rectangle formed by subtracting one Rectangle from another.

The function only subtracts the Rectangle specified by refSrcRect2 from the Rectangle specified by refSrcRect1 when the rectangles intersect completely in either the x- or y- direction.

For example, if refSrcRect1 has the coordinates {10, 10, 100, 100} and refSrcRect2 has the coordinates {50, 50, 150, 150}, the function sets the coordinates of the Rectangle pointed to by refDstRect to {10, 10, 100, 100}.

If refSrcRect1 has the coordinates {10, 10, 100, 100} and refSrcRect2 has the coordinates {50, 10, 150, 150}, however, the function sets the coordinates of the Rectangle pointed to by refDstRect to {10, 10, 50, 100}.

In other words, the resulting Rectangle is the bounding box of the geometric difference.

See Also