다음을 통해 공유


CRect::DeflateRect

DeflateRect deflates CRect by moving its sides toward its center.

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

Parameters

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

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

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

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

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

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

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

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

Remarks

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

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

Example

CRect rect(10, 10, 50, 50);

rect.DeflateRect(1, 2);

ASSERT(rect.left == 11 && rect.right == 49);
ASSERT(rect.top == 12 && rect.bottom == 48);

CRect rect2(10, 10, 50, 50);
CRect rectDeflate(1, 2, 3, 4);

rect2.DeflateRect(&rectDeflate);
ASSERT(rect2.left == 11 && rect2.right == 47);
ASSERT(rect2.top == 12 && rect2.bottom == 46);   

Requirements

Header: atltypes.h

See Also

Reference

CRect Class

Hierarchy Chart

CRect::InflateRect

CRect::operator -

CRect::operator -=

InflateRect

Other Resources

CRect Members