Share via


CSize::operator +

These operators add this CSize value to the value of parameter.

CSize operator +( 
   SIZE size  
) const throw( );
CPoint operator +( 
   POINT point  
) const throw( );
CRect operator +( 
   const RECT* lpRect  
) const throw( );

Remarks

See the following descriptions of the individual operators:

  • operator +( size )   This operation adds two CSize values.

  • operator +( point )   This operation offsets (moves) a POINT (or CPoint) value by this CSize value. The cx and cy members of this CSize value are added to the x and y data members of the POINT value. It is analogous to the version of CPoint::operator + that takes a SIZE parameter.

  • operator +( lpRect )   This operation offsets (moves) a RECT (or CRect) value by this CSize value. The cx and cy members of this CSize value are added to the left, top, right, and bottom data members of the RECT value. It is analogous to the version of CRect::operator + that takes a SIZE parameter.

Example

CSize sz1(100, 100);
CSize sz2(50,  25);
CSize szOut;

szOut = sz1 + sz2;

CSize szResult(150, 125);
ASSERT(szOut == szResult);

// works with SIZE, too

sz1 = CSize(100, 100);
SIZE sz3;
sz3.cx = 50;
sz3.cy = 25;

szOut = sz1 + sz3;
ASSERT(szOut == szResult);   

Requirements

Header: atltypes.h

See Also

Reference

CSize Class

Hierarchy Chart

CPoint::operator +

CRect::operator +

Other Resources

CSize Members