Share via


CPoint::operator +=

voidoperator+=(SIZEsize**);**

void operator +=( POINT point );

Parameters

size

Contains a SIZE structure or CSize object.

point

Contains a POINT structure or CPoint object.

Remarks

The first overload adds a size to the CPoint.

The second overload adds a point to the CPoint.

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

For example, adding CPoint(5, -7) to a variable which contains CPoint(30, 40) changes the variable to CPoint(35, 33).

Example

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

ptStart += szOffset;

CPoint   ptResult(135, 135);

ASSERT(ptResult == ptStart);

// also works on SIZE

ptStart = CPoint(100, 100);

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

ptStart += sz;

ASSERT(ptResult == ptStart);

CPoint OverviewClass MembersHierarchy Chart

See Also   CPoint::operator –=, CPoint::operator +, CPoint::Offset