Rectangle.Inflate Método

Definición

Aumenta una estructura Rectangle en la cantidad especificada.

Sobrecargas

Inflate(Size)

Aumenta este Rectangle en la cantidad especificada.

Inflate(Int32, Int32)

Aumenta este Rectangle en la cantidad especificada.

Inflate(Rectangle, Int32, Int32)

Crea y devuelve una copia aumentada de la estructura Rectangle especificada. La copia se aumenta en la cantidad especificada. La estructura Rectangle original no cambia.

Inflate(Size)

Source:
Rectangle.cs
Source:
Rectangle.cs
Source:
Rectangle.cs

Aumenta este Rectangle en la cantidad especificada.

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

Cantidad en la que se va a aumentar este rectángulo.

Ejemplos

El ejemplo siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse, que es un parámetro del Paint controlador de eventos. El código crea y Rectangle lo amplía en 50 unidades en ambos ejes. El rectángulo se dibuja para pantalla antes de la inflación (negro) y después de la inflación (rojo).

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

Comentarios

Este método amplía este rectángulo, no una copia de él. El rectángulo se amplía en ambas direcciones a lo largo de un eje. Por ejemplo, si un rectángulo de 50 a 50 se amplía en 50 en el eje X, el rectángulo resultante será de 150 unidades (el original 50, el 50 en la dirección menos y el 50 en la dirección más) manteniendo el centro geométrico del rectángulo.

Se aplica a

Inflate(Int32, Int32)

Source:
Rectangle.cs
Source:
Rectangle.cs
Source:
Rectangle.cs

Aumenta este Rectangle en la cantidad especificada.

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

Cantidad por la que se va a aumentar este Rectangle horizontalmente.

height
Int32

Cantidad por la que se va a aumentar este Rectangle verticalmente.

Ejemplos

En el ejemplo siguiente se crea una Rectangle estructura y se amplía en 100 unidades en la dirección del eje 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

Comentarios

Este método amplía este rectángulo, no una copia de él. El rectángulo se amplía en ambas direcciones a lo largo de un eje. Por ejemplo, si un rectángulo de 50 a 50 se amplía en 50 en el eje X, el rectángulo resultante será de 150 unidades (el original 50, el 50 en la dirección menos y el 50 en la dirección más) manteniendo el centro geométrico del rectángulo.

Si o xy es negativo, la Rectangle estructura se desinfla en la dirección correspondiente.

Se aplica a

Inflate(Rectangle, Int32, Int32)

Source:
Rectangle.cs
Source:
Rectangle.cs
Source:
Rectangle.cs

Crea y devuelve una copia aumentada de la estructura Rectangle especificada. La copia se aumenta en la cantidad especificada. La estructura Rectangle original no cambia.

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

Rectangle por el que se va a comenzar. Este rectángulo no se modifica.

x
Int32

Cantidad por la que se va a aumentar este Rectangle horizontalmente.

y
Int32

Cantidad por la que se va a aumentar este Rectangle verticalmente.

Devoluciones

Rectangle ampliado.

Ejemplos

El ejemplo siguiente está diseñado para su uso con Windows Forms y requiere PaintEventArgse, que es un parámetro del Paint controlador de eventos. El código crea y Rectangle lo amplía en 50 unidades en ambos ejes. Observe que el rectángulo resultante (rojo) es de 150 unidades en ambos ejes.

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

Comentarios

Este método realiza una copia de rect, amplía la copia y, a continuación, devuelve la copia ampliada. El rectángulo se amplía en ambas direcciones a lo largo de un eje. Por ejemplo, si un rectángulo de 50 a 50 se amplía en 50 en el eje X, el rectángulo resultante será de 150 unidades (el original 50, el 50 en la dirección menos y el 50 en la dirección más) manteniendo el centro geométrico del rectángulo.

Se aplica a