Udostępnij za pośrednictwem


CRect::EqualRect

Determines whether CRect is equal to the given rectangle.

BOOL EqualRect( 
   LPCRECT lpRect  
) const throw( );

Parameters

  • lpRect
    Points to a RECT structure or CRect object that contains the upper-left and lower-right corner coordinates of a rectangle.

Return Value

Nonzero if the two rectangles have the same top, left, bottom, and right values; otherwise 0.

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(35, 150, 10, 25);
CRect rect2(35, 150, 10, 25);
CRect rect3(98, 999,  6,  3);

ASSERT(rect1.EqualRect(rect2));
ASSERT(!rect1.EqualRect(rect3));

// works just fine against RECTs, as well

RECT test;
test.left = 35;
test.top = 150;
test.right = 10;
test.bottom = 25;

ASSERT(rect1.EqualRect(&test));   

Requirements

Header: atltypes.h

See Also

Reference

CRect Class

Hierarchy Chart

CRect::operator ==

CRect::operator !=

CRect::NormalizeRect

EqualRect

Other Resources

CRect Members