Declare Function UnionRect Lib "user32.dll" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Long
UnionRect determines the smallest possible rectangle that contains two other rectangles. This rectangle is called the union rectangle because it is derived from the union of the areas that the two source rectangles occupy. The union rectangle is put into the variable passed as lpDestRect. The function returns 0 if an error occured, or a non-zero value if successful.
Example:
' UnionRect example
Dim union As RECT, s1 As RECT, s2 As RECT
x = SetRect(s1, 50, 50, 150, 150) ' API sets s1 = (50,50)-(150,150)
x = SetRect(s2, 100, 100, 200, 200) ' s2 = (100,100)-(200,200)
x = UnionRect(union, s1, s2) ' union = (50,50)-(200,200)
Related Calls: IntersectRect, SubtractRect
Category: Rectangles
Back to the index.