Rectangle.Inflate Método

Definição

Amplia uma estrutura Rectangle pelo valor especificado.

Sobrecargas

Inflate(Size)

Amplia esse Rectangle de acordo com o valor especificado.

Inflate(Int32, Int32)

Amplia esse Rectangle de acordo com o valor especificado.

Inflate(Rectangle, Int32, Int32)

Cria e retorna uma cópia ampliada da estrutura Rectangle especificada. A cópia é ampliada segundo o valor especificado. A estrutura Rectangle original permanece inalterada.

Inflate(Size)

Origem:
Rectangle.cs
Origem:
Rectangle.cs
Origem:
Rectangle.cs

Amplia esse Rectangle de acordo com o valor especificado.

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)

Parâmetros

size
Size

O valor para inflar esse retângulo.

Exemplos

O exemplo a seguir foi projetado para uso com Windows Forms e requer PaintEventArgse, que é um parâmetro do Paint manipulador de eventos. O código cria um Rectangle e o amplia em 50 unidades em ambos os eixos. O retângulo é desenhado para tela antes da inflação (preta) e após a inflação (vermelho).

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

Comentários

Esse método amplia esse retângulo, não uma cópia dele. O retângulo é ampliado em ambas as direções ao longo de um eixo. Por exemplo, se um retângulo de 50 por 50 for ampliado em 50 no eixo x, o retângulo resultante terá 150 unidades de comprimento (os 50 originais, os 50 na direção de menos e os 50 na direção mais) mantendo o centro geométrico do retângulo.

Aplica-se a

Inflate(Int32, Int32)

Origem:
Rectangle.cs
Origem:
Rectangle.cs
Origem:
Rectangle.cs

Amplia esse Rectangle de acordo com o valor especificado.

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)

Parâmetros

width
Int32

O valor para inflar esse Rectangle horizontalmente.

height
Int32

O valor para inflar esse Rectangle verticalmente.

Exemplos

O exemplo a seguir cria uma Rectangle estrutura e a amplia em 100 unidades na direção do eixo x:

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

Comentários

Esse método amplia esse retângulo, não uma cópia dele. O retângulo é ampliado em ambas as direções ao longo de um eixo. Por exemplo, se um retângulo de 50 por 50 for ampliado em 50 no eixo x, o retângulo resultante terá 150 unidades de comprimento (os 50 originais, os 50 na direção de menos e os 50 na direção mais) mantendo o centro geométrico do retângulo.

Se ou xy for negativo, a Rectangle estrutura será esvaziada na direção correspondente.

Aplica-se a

Inflate(Rectangle, Int32, Int32)

Origem:
Rectangle.cs
Origem:
Rectangle.cs
Origem:
Rectangle.cs

Cria e retorna uma cópia ampliada da estrutura Rectangle especificada. A cópia é ampliada segundo o valor especificado. A estrutura Rectangle original permanece inalterada.

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

Parâmetros

rect
Rectangle

O Rectangle com o qual começar. Este retângulo não é modificado.

x
Int32

O valor para inflar esse Rectangle horizontalmente.

y
Int32

O valor para inflar esse Rectangle verticalmente.

Retornos

O Rectangle ampliado.

Exemplos

O exemplo a seguir foi projetado para uso com Windows Forms e requer PaintEventArgse, que é um parâmetro do Paint manipulador de eventos. O código cria um Rectangle e o amplia em 50 unidades em ambos os eixos. Observe que o retângulo resultante (vermelho) é de 150 unidades em ambos os eixos.

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

Comentários

Esse método faz uma cópia de rect, amplia a cópia e retorna a cópia ampliada. O retângulo é ampliado em ambas as direções ao longo de um eixo. Por exemplo, se um retângulo de 50 por 50 for ampliado em 50 no eixo x, o retângulo resultante terá 150 unidades de comprimento (os 50 originais, os 50 na direção de menos e os 50 na direção mais) mantendo o centro geométrico do retângulo.

Aplica-se a