Udostępnij za pośrednictwem


CRect::operator &

Returns a CRect that is the intersection of CRect and rect2.

CRect operator&( 
   const RECT& rect2  
) const throw( );

Parameters

  • rect2
    Contains a RECT or CRect.

Return Value

A CRect that is the intersection of CRect and rect2.

Remarks

The intersection is the largest rectangle that is contained in both rectangles.

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.

Example

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

rect3 = rect1 & rect2;

CRect   rectResult(100, 100, 200, 200);
ASSERT(rectResult == rect3);   

Requirements

Header: atltypes.h

See Also

Reference

CRect Class

Hierarchy Chart

CRect::IntersectRect

CRect::operator &=

CRect::operator |

CRect::NormalizeRect

Other Resources

CRect Members