Share via


CPoint::operator -=

The first overload subtracts a size from the CPoint.

void operator -=( 
   SIZE size  
) throw( ); 
void operator -=( 
   POINT point  
) throw( );

Parameters

  • size
    Contains a SIZE structure or CSize object.

  • point
    Contains a POINT structure or CPoint object.

Remarks

The second overload subtracts a point from the CPoint.

In both cases, subtraction is done by subtracting the x (or cx) member of the right-hand operand from the x member of the CPoint and subtracting the y (or cy) member of the right-hand operand from the y member of the CPoint.

For example, subtracting CPoint(5, -7) from a variable which contains CPoint(30, 40) changes the variable to CPoint(25, 47).

Example

CPoint   ptStart(100, 100);
CSize   szOffset(35, 35);

ptStart -= szOffset;

CPoint   ptResult(65, 65);

ASSERT(ptResult == ptStart);

// also works on SIZE

ptStart = CPoint(100, 100);

SIZE   sz;
sz.cx = 35;
sz.cy = 35;

ptStart -= sz;

ASSERT(ptResult == ptStart);   

Requirements

Header: atltypes.h

See Also

Reference

CPoint Class

Hierarchy Chart

CPoint::operator -

CPoint::operator +=

CPoint::Offset

Other Resources

CPoint Members