Rectangle.Inflate メソッド

定義

Rectangle 構造体を指定の量だけ拡大します。

オーバーロード

Inflate(Size)

この Rectangle を指定の量だけ拡大します。

Inflate(Int32, Int32)

この Rectangle を指定の量だけ拡大します。

Inflate(Rectangle, Int32, Int32)

指定の Rectangle 構造体の拡大したコピーを作成して返します。 コピーは、指定した量だけ拡大されます。 元の Rectangle 構造体は変更されません。

Inflate(Size)

この Rectangle を指定の量だけ拡大します。

public:
 void Inflate(System::Drawing::Size size);
public void Inflate (System.Drawing.Size size);
member this.Inflate : System.Drawing.Size -> unit
Public Sub Inflate (size As Size)

パラメーター

size
Size

この四角形の拡張量。

次の例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 このコードでは、 が Rectangle 作成され、両方の軸で 50 単位拡大されます。 四角形は、インフレーション (黒) の前とインフレーション (赤) の後に画面に描画されます。

public:
   void RectangleInflateTest2( PaintEventArgs^ e )
   {
      // Create a rectangle.
      Rectangle rect = Rectangle(100,100,50,50);

      // Draw the uninflated rectangle to screen.
      e->Graphics->DrawRectangle( Pens::Black, rect );

      // Set up the inflate size.
      System::Drawing::Size inflateSize = System::Drawing::Size( 50, 50 );

      // Call Inflate.
      rect.Inflate( inflateSize );

      // Draw the inflated rectangle to screen.
      e->Graphics->DrawRectangle( Pens::Red, rect );
   }
public void RectangleInflateTest2(PaintEventArgs e)
{
             
    // Create a rectangle.
    Rectangle rect = new Rectangle(100, 100, 50, 50);
             
    // Draw the uninflated rectangle to screen.
    e.Graphics.DrawRectangle(Pens.Black, rect);
             
    // Set up the inflate size.
    Size inflateSize = new Size(50, 50);
             
    // Call Inflate.
    rect.Inflate(inflateSize);
             
    // Draw the inflated rectangle to screen.
    e.Graphics.DrawRectangle(Pens.Red, rect);
}
Public Sub RectangleInflateTest2(ByVal e As PaintEventArgs)

    ' Create a rectangle.
    Dim rect As New Rectangle(100, 100, 50, 50)

    ' Draw the uninflated rect to screen.
    e.Graphics.DrawRectangle(Pens.Black, rect)

    ' Set up the inflate size.
    Dim inflateSize As New Size(50, 50)

    ' Call Inflate.
    rect.Inflate(inflateSize)

    ' Draw the inflated rect to screen.
    e.Graphics.DrawRectangle(Pens.Red, rect)
End Sub

注釈

このメソッドは、コピーではなく、この四角形を拡大します。 四角形は、軸に沿って両方向に拡大されます。 たとえば、x 軸に 50 x 50 の四角形を拡大した場合、結果の四角形は 150 単位の長さになります (元の 50、マイナス方向の 50、プラス方向の 50)。

適用対象

Inflate(Int32, Int32)

この Rectangle を指定の量だけ拡大します。

public:
 void Inflate(int width, int height);
public void Inflate (int width, int height);
member this.Inflate : int * int -> unit
Public Sub Inflate (width As Integer, height As Integer)

パラメーター

width
Int32

この Rectangle の水平方向の拡張量。

height
Int32

この Rectangle の垂直方向の拡張量。

次の例では、構造体を Rectangle 作成し、x 軸方向に 100 単位拡大します。

public:
   void RectangleInflateTest3( PaintEventArgs^ e )
   {
      // Create a rectangle.
      Rectangle rect = Rectangle(100,100,50,50);

      // Draw the uninflated rectangle to screen.
      e->Graphics->DrawRectangle( Pens::Black, rect );

      // Call Inflate.
      rect.Inflate( 50, 50 );

      // Draw the inflated rectangle to screen.
      e->Graphics->DrawRectangle( Pens::Red, rect );
   }
public void RectangleInflateTest3(PaintEventArgs e)
{
             
    // Create a rectangle.
    Rectangle rect = new Rectangle(100, 100, 50, 50);
             
    // Draw the uninflated rectangle to screen.
    e.Graphics.DrawRectangle(Pens.Black, rect);
             
    // Call Inflate.
    rect.Inflate(50, 50);
             
    // Draw the inflated rectangle to screen.
    e.Graphics.DrawRectangle(Pens.Red, rect);
}
Public Sub RectangleInflateTest3(ByVal e As PaintEventArgs)

    ' Create a rectangle.
    Dim rect As New Rectangle(100, 100, 50, 50)

    ' Draw the uninflated rectangle to screen.
    e.Graphics.DrawRectangle(Pens.Black, rect)

    ' Call Inflate.
    rect.Inflate(50, 50)

    ' Draw the inflated rectangle to screen.
    e.Graphics.DrawRectangle(Pens.Red, rect)
End Sub

注釈

このメソッドは、コピーではなく、この四角形を拡大します。 四角形は、軸に沿って両方向に拡大されます。 たとえば、x 軸に 50 x 50 の四角形を拡大した場合、結果の四角形は 150 単位の長さになります (元の 50、マイナス方向の 50、プラス方向の 50)。

または yx負のRectangle場合、構造体は対応する方向に膨張します。

適用対象

Inflate(Rectangle, Int32, Int32)

指定の Rectangle 構造体の拡大したコピーを作成して返します。 コピーは、指定した量だけ拡大されます。 元の Rectangle 構造体は変更されません。

public:
 static System::Drawing::Rectangle Inflate(System::Drawing::Rectangle rect, int x, int y);
public static System.Drawing.Rectangle Inflate (System.Drawing.Rectangle rect, int x, int y);
static member Inflate : System.Drawing.Rectangle * int * int -> System.Drawing.Rectangle
Public Shared Function Inflate (rect As Rectangle, x As Integer, y As Integer) As Rectangle

パラメーター

rect
Rectangle

最初の Rectangle。 この四角形は変更されません。

x
Int32

この Rectangle の水平方向の拡張量。

y
Int32

この Rectangle の垂直方向の拡張量。

戻り値

拡大された Rectangle

次の例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 このコードでは、 が Rectangle 作成され、両方の軸で 50 単位拡大されます。 結果として得られる四角形 (赤) は、両方の軸で 150 単位であることに注意してください。

public:
   void RectangleInflateTest( PaintEventArgs^ e )
   {
      // Create a rectangle.
      Rectangle rect = Rectangle(100,100,50,50);

      // Draw the uninflated rectangle to screen.
      e->Graphics->DrawRectangle( Pens::Black, rect );

      // Call Inflate.
      Rectangle rect2 = Rectangle::Inflate( rect, 50, 50 );

      // Draw the inflated rectangle to screen.
      e->Graphics->DrawRectangle( Pens::Red, rect2 );
   }
public void RectangleInflateTest(PaintEventArgs e)
{
             
    // Create a rectangle.
    Rectangle rect = new Rectangle(100, 100, 50, 50);
             
    // Draw the uninflated rectangle to screen.
    e.Graphics.DrawRectangle(Pens.Black, rect);
             
    // Call Inflate.
    Rectangle rect2 = Rectangle.Inflate(rect, 50, 50);
             
    // Draw the inflated rectangle to screen.
    e.Graphics.DrawRectangle(Pens.Red, rect2);
}
Public Sub RectangleInflateTest(ByVal e As PaintEventArgs)

    ' Create a rectangle.
    Dim rect As New Rectangle(100, 100, 50, 50)

    ' Draw the uninflated rectangle to screen.
    e.Graphics.DrawRectangle(Pens.Black, rect)

    ' Call Inflate.
    Dim rect2 As Rectangle = Rectangle.Inflate(rect, 50, 50)

    ' Draw the inflated rectangle to screen.
    e.Graphics.DrawRectangle(Pens.Red, rect2)
End Sub

注釈

このメソッドは の rectコピーを作成し、コピーを拡大し、拡大されたコピーを返します。 四角形は、軸に沿って両方向に拡大されます。 たとえば、x 軸に 50 x 50 の四角形を拡大した場合、結果の四角形は 150 単位の長さになります (元の 50、マイナス方向の 50、プラス方向の 50)。

適用対象