共用方式為


CPoint::Offset

將值加入至 CPointxy 成員。

void Offset( 
   int xOffset, 
   int yOffset  
) throw( ); 
void Offset( 
   POINT point  
) throw( ); 
void Offset( 
   SIZE size  
) throw( );

參數

  • xOffset
    指定數量的位移 CPointx 成員。

  • yOffset
    指定數量的位移 CPointy 成員。

  • point
    指定的量 (CPoint) 位移 CPoint

  • size
    指定的量 (大小CSize) 位移 CPoint

範例

CPoint   ptStart(100, 100);
ptStart.Offset(35, 35);

CPoint   ptResult(135, 135);
ASSERT(ptStart == ptResult);

// works with POINT, too

ptStart = CPoint(100, 100);
POINT pt;

pt.x = 35;
pt.y = 35;

ptStart.Offset(pt);

ASSERT(ptStart == ptResult);

// works with SIZE, too

ptStart = CPoint(100, 100);
SIZE size;

size.cx = 35;
size.cy = 35;

ptStart.Offset(size);

ASSERT(ptStart == ptResult);   

需求

Header: atltypes.h

請參閱

參考

CPoint Class

階層架構圖表

CPoint::operator +=

CPoint::operator -=