- U -


UnionRect Function

Declare Function UnionRect Lib "user32.dll" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As Long

UnionRect determines the smallest (or tightest) possible rectangle containing two other rectangles. This rectangle is called the union rectangle because it is derived from the area that the two rectangles occupy. The union rectangle will of course be at least as big as either rectangle. You can safely ignore the value returned, since the union rectangle is put into lpDestRect.
lpDestRectReceives the coordinates of the union rectangle.
lpSrc1RectOne of the rectangles that determine the union rectangle.
lpSrc2RectThe other rectangle that determines the union rectangle.
Example:
  's1.Left = 50, .Top = .50, .Right = 150, .Bottom = 150
  's2.Left = 100, .Top = 100, .Right = 200, .Bottom = 200
  Dim union As RECT, s1 As RECT, s2 As RECT
  x = SetRect(s1, 50, 50, 150, 150) 'API function sets the rectangle
  x = SetRect(s2, 100, 100, 200, 200)
  x = UnionRect(union, s1, s2)
  'Now, union.Left = 50, .Top = 50, .Right = 200, .Bottom = 200


Related Calls: IntersectRect, SubtractRect
Category: RECT Manipulation
Back to the index.


Home
Paul Kuliniewicz
E-mail: Borg953@aol.com
All material presented on these pages is Copyright © Paul Kuliniewicz, except for other copyrighted material.
http://members.aol.com/Borg953/api/u.html