CPoint::operator +

使用這個運算子來 CPointCSize 物件位移 CPoint ,或是 CPoint位移 CRect

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

參數

傳回值

CPoint 由大小、 CPoint 位移的位置,或按位移的 CRect 位移。

備註

例如,使用位移 (Offset) 點的前兩個多載其中一 CPoint(25, -19) 以點數大小 CSize(15, 5)CPoint(15, 5) 或傳回值 CPoint(40, -14)。

將矩形加入點位移傳回矩形會在指定的點 xy 值之後。例如,使用最後一個多載位移矩形 CRect(125, 219, 325, 419) 由按 CPoint(25, -19) 傳回 CRect(150, 200, 350, 400)。

範例

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);   

需求

Header: atltypes.h

請參閱

參考

CPoint 類別

階層架構圖

CPoint::operator - =

CPoint::operator -

CPoint::operator +=

CSize::operator +

CRect::operator +

CPoint::Offset

CRect::OffsetRect