Udostępnij za pośrednictwem


CRect::operator -

The first two overloads return a CRect object that is equal to CRect displaced by the specified offsets.

CRect operator -( 
   POINT point  
) const throw( ); 
CRect operator -( 
   SIZE size  
) const throw( ); 
CRect operator -( 
   LPCRECT lpRect  
) const throw( );

Parameters

  • point
    A POINT structure or CPoint object that specifies the number of units to move the return value.

  • size
    A SIZE structure or CSize object that specifies the number of units to move the return value.

  • lpRect
    Points to a RECT structure or CRect object that contains the number of units to deflate each side of the return value.

Return Value

The CRect resulting from moving or deflating CRect by the number of units specified in the parameter.

Remarks

The parameter's x and y (or cx and cy) parameters are subtracted from CRect's position.

The third overload returns a new CRect that is equal to CRect deflated by the number of units specifed in each member of the parameter. Note that this overload functions like DeflateRect, not SubtractRect.

Example

CRect   rect1(100, 235, 200, 335);
CPoint   pt(35, 65);
CRect   rect2;

rect2 = rect1 - pt;

CRect   rectResult(65, 170, 165, 270);

ASSERT(rect2 == rectResult);   

Requirements

Header: atltypes.h

See Also

Reference

CRect Class

Hierarchy Chart

CRect::operator -=

CRect::operator +

CRect::OffsetRect

CRect::DeflateRect

CRect::SubtractRect

Other Resources

CRect Members