Export (0) Print
Expand All

CRect::UnionRect

Makes the dimensions of CRect equal to the union of the two source rectangles.

BOOL UnionRect( 
   LPCRECT lpRect1, 
   LPCRECT lpRect2  
) throw( );

lpRect1

Points to a RECT or CRect that contains a source rectangle.

lpRect2

Points to a RECT or CRect that contains a source rectangle.

Nonzero if the union is not empty; 0 if the union is empty.

The union is the smallest rectangle that contains both source rectangles.

Windows ignores the dimensions of an empty rectangle; that is, a rectangle that has no height or has no width.

Note Note

Both of the rectangles must be normalized or this function may fail. You can call NormalizeRect to normalize the rectangles before calling this function.

CRect   rect1(100,   0, 200, 300);
CRect   rect2(0, 100, 300, 200);
CRect   rect3;

rect3.UnionRect(&rect1, &rect2);

CRect   rectResult(0, 0, 300, 300);
ASSERT(rectResult == rect3);   

Header: atltypes.h

Show:
© 2014 Microsoft