User32SubtractRect(Rectangle, Rectangle, Rectangle) Method

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.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll")]
public static bool SubtractRect(
	out Rectangle refDstRect,
	in Rectangle refSrcRect1,
	in Rectangle refSrcRect2
)

Parameters

refDstRect  Rectangle
A pointer to the Rectangle structure that receives the coordinates of the Rectangle determined by subtracting the Rectangle pointed to by refSrcRect2 from the Rectangle pointed to by refSrcRect1.
refSrcRect1  Rectangle
A pointer to a Rectangle structure from which the function subtracts the Rectangle pointed to by refSrcRect2.
refSrcRect2  Rectangle
A pointer to a Rectangle structure that the function subtracts from the Rectangle pointed to by refSrcRect1.

Return Value

Boolean
If the resulting rectangle is empty, the return value is .

If the resulting rectangle is not empty, the return value is .

Remarks

See Also