User32SubtractRect(NativeRectangle, NativeRectangle, NativeRectangle) Method

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.

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 NativeRectangle refDstRect,
	in NativeRectangle refSrcRect1,
	in NativeRectangle refSrcRect2
)

Parameters

refDstRect  NativeRectangle
A pointer to the NativeRectangle structure that receives the coordinates of the NativeRectangle determined by subtracting the NativeRectangle pointed to by refSrcRect2 from the NativeRectangle pointed to by refSrcRect1.
refSrcRect1  NativeRectangle
A pointer to a NativeRectangle structure from which the function subtracts the NativeRectangle pointed to by refSrcRect2.
refSrcRect2  NativeRectangle
A pointer to a NativeRectangle structure that the function subtracts from the NativeRectangle 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