Idioma

Rect.Inflate Método

Definição

Cria um retângulo que resulta da expansão ou encolhimento de um retângulo na quantidade especificada.

Sobrecargas

Nome Descrição
Inflate(Size)

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

Inflate(Double, Double)

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

Inflate(Rect, Size)

Devolve o retângulo que resulta 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 encolhimento 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 a quantidade a expandir o retângulo. A Size propriedade da Width estrutura especifica a quantidade a aumentar dos retângulos Left e Right propriedades. A Size propriedade da Height estrutura especifica a quantidade a aumentar dos retângulos Top e Bottom propriedades.

Exceções

Este método chama-se no Empty retângulo.

Exemplos

O exemplo seguinte 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;
}

Observações

O Width do retângulo resultante é aumentado em duas vezes o Width da estrutura especificada Size , porque tanto o lado esquerdo como o direito do retângulo estão inflados. Da mesma forma, o Height do retângulo resultante é aumentado pelo dobro da Height estrutura especificada Size .

Consulte também

Aplica-se a

Inflate(Double, Double)

Expande ou encolhe o retângulo usando as quantidades especificadas de largura e altura, 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 encolher os lados esquerdo e direito do retângulo.

height
Double

A quantidade para expandir ou encolher os lados superior e inferior do retângulo.

Exceções

Este método chama-se no Empty retângulo.

Exemplos

O exemplo seguinte 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;
}

Observações

O Width do retângulo resultante é aumentado ou diminuído pelo dobro do deslocamento de largura especificado, porque é aplicado tanto ao lado esquerdo como ao direito do retângulo. Da mesma forma, o Height comprimento do retângulo resultante é aumentado ou diminuído pelo dobro da altura especificada.

Se a largura ou altura especificada encolher o retângulo em mais do que a sua corrente Width ou Height - dando ao retângulo uma área negativa - o retângulo torna-se o retângulo.Empty

Consulte também

Aplica-se a

Inflate(Rect, Size)

Devolve o retângulo que resulta 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 modificar.

size
Size

Especifica a quantidade a expandir o retângulo. A Size propriedade da Width estrutura especifica a quantidade a aumentar dos retângulos Left e Right propriedades. A Size propriedade da Height estrutura especifica a quantidade a aumentar dos retângulos Top e Bottom propriedades.

Devoluções

O retângulo resultante.

Exceções

rect é um Empty retângulo.

Exemplos

O exemplo seguinte 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;
}

Observações

O Width do retângulo resultante é aumentado em duas vezes o Width da estrutura especificada Size , porque tanto o lado esquerdo como o direito do retângulo estão inflados. Da mesma forma, o Height do retângulo resultante é aumentado pelo dobro da Height estrutura especificada Size .

Consulte também

Aplica-se a

Inflate(Rect, Double, Double)

Cria um retângulo que resulta da expansão ou encolhimento 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 modificar.

width
Double

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

height
Double

A quantidade para expandir ou encolher os lados superior e inferior do retângulo.

Devoluções

O retângulo resultante.

Exceções

rect é um Empty retângulo.

Exemplos

O exemplo seguinte 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;
}

Observações

O Width do retângulo resultante é aumentado ou diminuído pelo dobro do deslocamento de largura especificado, porque é aplicado tanto ao lado esquerdo como ao direito do retângulo. Da mesma forma, o Height comprimento do retângulo resultante é aumentado ou diminuído pelo dobro da altura especificada.

Se os modificadores de largura ou altura especificados diminuírem o retângulo em mais do que a sua corrente Width ou Height - dando ao retângulo uma área negativa - este método retorna Rect.Empty.

Consulte também

Aplica-se a