다음을 통해 공유


CPoint::Offset

Adds values to the x and y members of the CPoint.

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

Parameters

  • xOffset
    Specifies the amount to offset the x member of the CPoint.

  • yOffset
    Specifies the amount to offset the y member of the CPoint.

  • point
    Specifies the amount (POINT or CPoint) to offset the CPoint.

  • size
    Specifies the amount (SIZE or CSize) to offset the CPoint.

Example

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

Requirements

Header: atltypes.h

See Also

Reference

CPoint Class

Hierarchy Chart

CPoint::operator +=

CPoint::operator -=