CRect::InflateRect

InflateRect inflates CRect by moving its sides away from its center.

void InflateRect( 
   int x, 
   int y  
) throw( );
void InflateRect( 
   SIZE size  
) throw( );
void InflateRect( 
   LPCRECT lpRect  
) throw( );
void InflateRect( 
   int l, 
   int t, 
   int r, 
   int b  
) throw( );

Parameters

  • x
    Specifies the number of units to inflate the left and right sides of CRect.

  • y
    Specifies the number of units to inflate the top and bottom of CRect.

  • size
    A SIZE or CSize that specifies the number of units to inflate CRect. The cx value specifies the number of units to inflate the left and right sides and the cy value specifies the number of units to inflate the top and bottom.

  • lpRect
    Points to a RECT structure or CRect that specifies the number of units to inflate each side.

  • l
    Specifies the number of units to inflate the left side of CRect.

  • t
    Specifies the number of units to inflate the top of CRect.

  • r
    Specifies the number of units to inflate the right side of CRect.

  • b
    Specifies the number of units to inflate the bottom of CRect.

Remarks

To do this, InflateRect subtracts units from the left and top and adds units to the right and bottom. The parameters of InflateRect are signed values; positive values inflate CRect and negative values deflate it.

The first two overloads inflate both pairs of opposite sides of CRect so that its total width is increased by two times x (or cx) and its total height is increased by two times y (or cy). The other two overloads inflate each side of CRect independently of the others.

Example

CRect rect(0, 0, 300, 300);
rect.InflateRect(50, 200);

// rect is now (-50, -200, 350, 500)
ASSERT(rect == CRect(-50, -200, 350, 500));   

Requirements

Header: atltypes.h

See Also

Reference

CRect Class

Hierarchy Chart

CRect::DeflateRect

CRect::operator +

CRect::operator +=

InflateRect

Other Resources

CRect Members