Rect.Inflate Método

Definição

Cria um retângulo que resulta da expansão ou redução de um retângulo pela quantidade especificada.

Sobrecargas

Nome Description
Inflate(Size)

Expande o retângulo usando o especificado Size, em todas as direções.

Inflate(Double, Double)

Expande ou reduz o retângulo usando as quantidades de largura e altura especificadas, em todas as direções.

Inflate(Rect, Size)

Retorna o retângulo resultante da expansão do retângulo especificado pelo especificado Size, em todas as direções.

Inflate(Rect, Double, Double)

Cria um retângulo que resulta da expansão ou redução do retângulo especificado pelas quantidades de largura e altura especificadas, em todas as direções.

Inflate(Size)

Expande o retângulo usando o especificado Size, em todas as direções.

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 o valor para expandir o retângulo. A Size propriedade da Width estrutura especifica o valor para aumentar as propriedades e Left o retânguloRight. A Size propriedade da Height estrutura especifica o valor para aumentar as propriedades e Top o retânguloBottom.

Exceções

Esse método é chamado no Empty retângulo.

Exemplos

O exemplo a seguir mostra como usar o Inflate(Size) método para aumentar o tamanho de um retâ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;
}

Comentários

O Width retângulo resultante é aumentado em duas vezes a Width estrutura especificada Size , pois os lados esquerdo e direito do retângulo são inflados. Da mesma forma, o Height retângulo resultante é aumentado duas vezes a Height estrutura especificada Size .

Confira também

Aplica-se a

Inflate(Double, Double)

Expande ou reduz o retângulo usando as quantidades de largura e altura especificadas, em todas as direções.

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

A quantidade pela qual expandir ou reduzir os lados esquerdo e direito do retângulo.

height
Double

A quantidade pela qual expandir ou reduzir os lados superior e inferior do retângulo.

Exceções

Esse método é chamado no Empty retângulo.

Exemplos

O exemplo a seguir mostra como usar o Inflate(Double, Double) método para alterar o tamanho de um retâ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;
}

Comentários

O Width retângulo resultante é aumentado ou reduzido duas vezes o deslocamento de largura especificado, pois é aplicado aos lados esquerdo e direito do retângulo. Da mesma forma, o Height retângulo resultante é aumentado ou reduzido em duas vezes a altura especificada.

Se a largura ou altura especificada reduzir o retângulo em mais do que seu atual Width ou Height - dando ao retângulo uma área negativa - o retângulo se tornará o Empty retângulo.

Confira também

Aplica-se a

Inflate(Rect, Size)

Retorna o retângulo resultante da expansão do retângulo especificado pelo especificado Size, em todas as direções.

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

A Rect estrutura a ser modificada.

size
Size

Especifica o valor para expandir o retângulo. A Size propriedade da Width estrutura especifica o valor para aumentar as propriedades e Left o retânguloRight. A Size propriedade da Height estrutura especifica o valor para aumentar as propriedades e Top o retânguloBottom.

Retornos

O retângulo resultante.

Exceções

rect é um Empty retângulo.

Exemplos

O exemplo a seguir mostra como usar o Inflate(Rect, Size) método para alterar o tamanho de um retâ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;
}

Comentários

O Width retângulo resultante é aumentado em duas vezes a Width estrutura especificada Size , pois os lados esquerdo e direito do retângulo são inflados. Da mesma forma, o Height retângulo resultante é aumentado duas vezes a Height estrutura especificada Size .

Confira também

Aplica-se a

Inflate(Rect, Double, Double)

Cria um retângulo que resulta da expansão ou redução do retângulo especificado pelas quantidades de largura e altura especificadas, em todas as direções.

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

A Rect estrutura a ser modificada.

width
Double

A quantidade pela qual expandir ou reduzir os lados esquerdo e direito do retângulo.

height
Double

A quantidade pela qual expandir ou reduzir os lados superior e inferior do retângulo.

Retornos

O retângulo resultante.

Exceções

rect é um Empty retângulo.

Exemplos

O exemplo a seguir mostra como usar o Inflate(Rect, Double, Double) método para alterar o tamanho de um retâ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;
}

Comentários

O Width retângulo resultante é aumentado ou reduzido duas vezes o deslocamento de largura especificado, pois é aplicado aos lados esquerdo e direito do retângulo. Da mesma forma, o Height retângulo resultante é aumentado ou reduzido em duas vezes a altura especificada.

Se os modificadores de largura ou altura especificados reduzirem o retângulo em mais do que seu atual Width ou Height - dando ao retângulo uma área negativa - esse método retornará Rect.Empty.

Confira também

Aplica-se a