Compartir a través de


Rect.Inflate(INT, INT) method

Applies to: desktop apps only

The Rect::Inflate method expands the rectangle by dx on the left and right edges, and by dy on the top and bottom edges.

Syntax

VOID Inflate(
  [in]  INT dx,
  [in]  INT dy
);

Parameters

  • dx [in]
    Type: INT

    Integer that specifies the amount to expand the rectangle on the left and right edges.

  • dy [in]
    Type: INT

    Integer that specifies the amount to expand the rectangle on the top and bottom edges.

Return value

This method does not return a value.

Remarks

The x-coordinate of the left edge is decreased by dx, and the x-coordinate of the right edge is increased by dx. The y-coordinate of the top edge is decreased by dy and the y-coordinate of the bottom edge is increased by dy.

Examples

The following example creates a Rect object, draws the rectangle, inflates the rectangle, and then redraws the rectangle.

VOID Example_InflateDxDy(HDC hdc)
{
   Graphics graphics(hdc);
   Pen pen(Color(255, 0, 0, 0));

   // Create and draw a rectangle.
   Rect rect(100, 100, 80, 40);
   graphics.DrawRectangle(&pen, rect);

   // Inflate the rectangle, and then redraw the rectangle.
   rect.Inflate(20, 10);
   graphics.DrawRectangle(&pen, rect);
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplustypes.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Rect

RectF

Using a Pen to Draw Lines and Rectangles

Pens, Lines, and Rectangles

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012