Rect.Inflate Método

Definición

Crea un rectángulo que es el resultado de expandir o reducir un rectángulo cantidad especificada.

Sobrecargas

Inflate(Size)

Expande el rectángulo utilizando la estructura Sizeespecificada, en todas las direcciones.

Inflate(Double, Double)

Se expande o reduce el rectángulo con el ancho y el alto especificados, en todas las direcciones.

Inflate(Rect, Size)

Devuelve el rectángulo que es el resultado de expandir el rectángulo especificado por la estructura Size especificada, en todas las direcciones.

Inflate(Rect, Double, Double)

Crea un rectángulo que es el resultado de expandir o reducir el rectángulo especificado por el ancho y el alto especificados, en todas las direcciones.

Inflate(Size)

Expande el rectángulo utilizando la estructura Sizeespecificada, en todas las direcciones.

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

Parámetros

size
Size

Especifica la cantidad que se va a expandir el rectángulo. La propiedad Size de la estructura Width especifica la cantidad que se van a incrementar las propiedades Left y Right del rectángulo. La propiedad Size de la estructura Height especifica la cantidad que se van a incrementar las propiedades Top y Bottom del rectángulo.

Excepciones

Se llama a este método en el rectángulo de la propiedad Empty.

Ejemplos

En el ejemplo siguiente se muestra cómo usar el Inflate(Size) método para aumentar el tamaño de un rectángulo.

private Size inflateExample1()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle.Location = new Point(10, 5);

    // Set the Size property of the rectangle with a width of 200
    // and a height of 50.
    myRectangle.Size = new Size(200, 50);

    // Use the Inflate method to expand the rectangle by the specified Size in all
    // directions. The new size is 240,110. Note: Width of the resulting rectangle  
    // is increased by twice the Width of the specified Size structure because  
    // both the left and right sides of the rectangle are inflated. Likewise, the 
    // Height of the resulting rectangle is increased by twice the Height of the 
    // specified Size structure.
    myRectangle.Inflate(new Size(20,30));

    return myRectangle.Size;
}

Comentarios

El Width del rectángulo resultante aumenta dos veces la Width de la estructura especificada Size , ya que se inflan los lados izquierdo y derecho del rectángulo. Del mismo modo, el Height del rectángulo resultante se incrementa dos veces la Height de la estructura especificada Size .

Consulte también

Se aplica a

Inflate(Double, Double)

Se expande o reduce el rectángulo con el ancho y el alto especificados, en todas las direcciones.

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

Parámetros

width
Double

Cantidad que se expanden o reducen los lados izquierdo y derecho del rectángulo.

height
Double

Cantidad que se expanden o reducen los lados superior e inferior del rectángulo.

Excepciones

Se llama a este método en el rectángulo de la propiedad Empty.

Ejemplos

En el ejemplo siguiente se muestra cómo usar el Inflate(Double, Double) método para cambiar el tamaño de un rectángulo.

private Size inflateExample2()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle.Location = new Point(10, 5);

    // Set the Size property of the rectangle with a width of 200
    // and a height of 50.
    myRectangle.Size = new Size(200,50);

    // Use the Inflate method to expand or shrink the rectangle by the specified 
    // width and height amounts. The new size is 160,150 (width shrunk by 40 and  
    // height increased by 100). Note: Width of the resulting rectangle is increased 
    // or shrunk by twice the specified width, because both the left and right sides  
    // of the rectangle are inflated or shrunk. Likewise, the height of the resulting 
    // rectangle is increased or shrunk by twice the specified height.
    myRectangle.Inflate(-20,50);

    return myRectangle.Size;
}

Comentarios

El Width del rectángulo resultante aumenta o disminuye dos veces el desplazamiento de ancho especificado, ya que se aplica a los lados izquierdo y derecho del rectángulo. Del mismo modo, el Height del rectángulo resultante aumenta o disminuye dos veces el alto especificado.

Si el ancho o alto especificado reduce el rectángulo por más de su actual Width o Height , dando al rectángulo un área negativa, el rectángulo se convierte en el Empty rectángulo.

Consulte también

Se aplica a

Inflate(Rect, Size)

Devuelve el rectángulo que es el resultado de expandir el rectángulo especificado por la estructura Size especificada, en todas las direcciones.

public:
 static System::Windows::Rect Inflate(System::Windows::Rect rect, System::Windows::Size size);
public static System.Windows.Rect Inflate (System.Windows.Rect rect, System.Windows.Size size);
static member Inflate : System.Windows.Rect * System.Windows.Size -> System.Windows.Rect
Public Shared Function Inflate (rect As Rect, size As Size) As Rect

Parámetros

rect
Rect

Estructura Rect que se va a modificar.

size
Size

Especifica la cantidad que se va a expandir el rectángulo. La propiedad Size de la estructura Width especifica la cantidad que se van a incrementar las propiedades Left y Right del rectángulo. La propiedad Size de la estructura Height especifica la cantidad que se van a incrementar las propiedades Top y Bottom del rectángulo.

Devoluciones

Rect

Rectángulo resultante.

Excepciones

rect es un rectángulo Empty.

Ejemplos

En el ejemplo siguiente se muestra cómo usar el Inflate(Rect, Size) método para cambiar el tamaño de un rectángulo.

private Size inflateExample3()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle.Location = new Point(10, 5);

    // Set the Size property of the rectangle with a width of 200
    // and a height of 50.
    myRectangle.Size = new Size(200, 50);

    // Use the static Inflate method to return an expanded version of myRectangle1.   
    // The size of myRectangle2 is 240,110. Note: Width of the resulting rectangle is increased 
    // by twice the Width of the specified Size structure, because both the left and right 
    // sides of the rectangle are inflated. Likewise, the Height of the resulting 
    // rectangle is increased by twice the Height of the specified Size structure.
    Rect myRectangle2 = Rect.Inflate(myRectangle, new Size(20, 30));

    return myRectangle2.Size;
}

Comentarios

El Width del rectángulo resultante aumenta dos veces la Width de la estructura especificada Size , ya que se inflan los lados izquierdo y derecho del rectángulo. Del mismo modo, el Height del rectángulo resultante se incrementa dos veces la Height de la estructura especificada Size .

Consulte también

Se aplica a

Inflate(Rect, Double, Double)

Crea un rectángulo que es el resultado de expandir o reducir el rectángulo especificado por el ancho y el alto especificados, en todas las direcciones.

public:
 static System::Windows::Rect Inflate(System::Windows::Rect rect, double width, double height);
public static System.Windows.Rect Inflate (System.Windows.Rect rect, double width, double height);
static member Inflate : System.Windows.Rect * double * double -> System.Windows.Rect
Public Shared Function Inflate (rect As Rect, width As Double, height As Double) As Rect

Parámetros

rect
Rect

Estructura Rect que se va a modificar.

width
Double

Cantidad que se expanden o reducen los lados izquierdo y derecho del rectángulo.

height
Double

Cantidad que se expanden o reducen los lados superior e inferior del rectángulo.

Devoluciones

Rect

Rectángulo resultante.

Excepciones

rect es un rectángulo Empty.

Ejemplos

En el ejemplo siguiente se muestra cómo usar el Inflate(Rect, Double, Double) método para cambiar el tamaño de un rectángulo.

private Size inflateExample4()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // The Location property specifies the coordinates of the upper left-hand 
    // corner of the rectangle. 
    myRectangle.Location = new Point(10, 5);

    // Set the Size property of the rectangle with a width of 200
    // and a height of 50.
    myRectangle.Size = new Size(200, 50);

    // Use the static Inflate method to return a version of myRectangle with a shrunk
    // width and expanded height. The size of myRectangle2 is 160,150. Note: Width of the resulting 
    // rectangle is increased or shrunk by twice the specified width, because both the
    // left and right sides of the rectangle are inflated or shrunk. Likewise, the height 
    // of the resulting rectangle is increased or shrunk by twice the specified height.
    Rect myRectangle2 = Rect.Inflate(myRectangle, -20, 50);

    return myRectangle2.Size;
}

Comentarios

El Width del rectángulo resultante aumenta o disminuye dos veces el desplazamiento de ancho especificado, ya que se aplica a los lados izquierdo y derecho del rectángulo. Del mismo modo, el Height del rectángulo resultante aumenta o disminuye dos veces el alto especificado.

Si los modificadores de ancho o alto especificados reducen el rectángulo por más de su actual Width o Height , lo que proporciona al rectángulo un área negativa, este método devuelve Rect.Empty.

Consulte también

Se aplica a