Partager via


CSize::operator -

The first three of these operators subtract 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( );
CSize operator -( ) const throw( );

Remarks

The fourth operator, the unary minus, changes the sign of the CSize value. See the following descriptions of the individual operators:

  • operator -( size )   This operation subtracts two CSize values.

  • operator -( point )   This operation offsets (moves) a POINT or CPoint value by the additive inverse of this CSize value. The cx and cy of this CSize value are subtracted from 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 the additive inverse of this CSize value. The cx and cy members of this CSize value are subtracted from 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.

  • operator -( )   This operation returns the additive inverse of this CSize value.

Example

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

szOut = sz1 - sz2;

CSize szResult(50, 75);
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