Condividi tramite


CPoint::operator +

Utilizzare questo operatore per compensare CPoint da un oggetto CSize o CPoint, o per compensare CRect da CPoint.

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

Parametri

  • size
    Contiene una struttura DIMENSIONE o un oggetto CSize.

  • point
    Contiene una struttura QUESTION o un oggetto CPoint.

  • lpRect
    Contiene un puntatore a una struttura RECT o a un oggetto CRect.

Valore restituito

CPoint che è leggermente da una dimensione, da CPoint che è compensata da un punto, o da CRect compensato da un punto.

Note

Ad esempio, utilizzando uno dei primi due overload per compensare il punto CPoint(25, -19) da un punto CPoint(15, 5) o per ridimensionare il termine CSize(15, 5) il valore CPoint(40, -14).

Aggiunta di un rettangolo in un punto restituisce il rettangolo dopo essere stato compensato dai valori y e x specificati nel punto.Ad esempio, l'utilizzo dell'ultimo overload per compensare un rettangolo CRect(125, 219, 325, 419) da un punto CPoint(25, -19) restituisce CRect(150, 200, 350, 400).

Esempio

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

ptEnd = ptStart + szOffset;

CPoint   ptResult(135, 135);

ASSERT(ptResult == ptEnd);

// also works on SIZE

ptStart = CPoint(100, 100);

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

ptEnd = ptStart + sz;

ASSERT(ptResult == ptEnd);   

Requisiti

Header: atltypes.h

Vedere anche

Riferimenti

Classe di CPoint

Grafico della gerarchia

CPoint::operator - =

CPoint::operator -

CPoint::operator +=

CSize::operator +

CRect::operator +

CPoint::Offset

CRect::OffsetRect