Partager via


CRect::OffsetRect

Moves CRect by the specified offsets.

void OffsetRect( 
   int x, 
   int y  
) throw( ); 
void OffsetRect( 
   POINT point  
) throw( ); 
void OffsetRect( 
   SIZE size  
) throw( );

Parameters

  • x
    Specifies the amount to move left or right. It must be negative to move left.

  • y
    Specifies the amount to move up or down. It must be negative to move up.

  • point
    Contains a POINT structure or CPoint object specifying both dimensions by which to move.

  • size
    Contains a SIZE structure or CSize object specifying both dimensions by which to move.

Remarks

Moves CRect x units along the x-axis and y units along the y-axis. The x and y parameters are signed values, so CRect can be moved left or right and up or down.

Example

CRect rect(0, 0, 35, 35);

rect.OffsetRect(230, 230);

// rect is now (230, 230, 265, 265)
ASSERT(rect == CRect(230, 230, 265, 265));   

Requirements

Header: atltypes.h

See Also

Reference

CRect Class

Hierarchy Chart

CRect::operator +

CRect::operator +=

CRect::operator -

CRect::operator -=