Rect.Inflate Método

Definição

Cria um retângulo que resulta da expansão ou da redução de um retângulo pelo valor especificado.

Sobrecargas

Inflate(Size)

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

Inflate(Double, Double)

Aumenta ou diminui o retângulo usando os valores de largura e altura especificados, em todas as direções.

Inflate(Rect, Size)

Retorna o retângulo resultante da expansão do retângulo indicado pelo Size especificado, em todos os sentidos.

Inflate(Rect, Double, Double)

Cria um retângulo que é o resultado de expandir ou reduzir o retângulo especificado pelos valores especificados de largura e altura em todas as direções.

Inflate(Size)

Expande o retângulo usando o Size especificado 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 para expandir o retângulo. A estrutura Size, propriedade Width, especifica o valor para aumentar o Left do retângulo e as propriedades Right. A estrutura Size, propriedade Height, especifica o valor para aumentar o Top do retângulo e as propriedades Bottom.

Exceções

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

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 em duas vezes a Height estrutura especificada Size .

Confira também

Aplica-se a

Inflate(Double, Double)

Aumenta ou diminui o retângulo usando os valores de largura e altura especificados, 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 retângulo Empty.

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 em 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 a 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 indicado pelo Size especificado, em todos os sentidos.

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 estrutura Rect a ser modificada.

size
Size

Especifica a quantidade para expandir o retângulo. A estrutura Size, propriedade Width, especifica o valor para aumentar o Left do retângulo e as propriedades Right. A estrutura Size, propriedade Height, especifica o valor para aumentar o Top do retângulo e as propriedades Bottom.

Retornos

Rect

O retângulo resultante.

Exceções

rect é um retângulo Empty.

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 em duas vezes a Height estrutura especificada Size .

Confira também

Aplica-se a

Inflate(Rect, Double, Double)

Cria um retângulo que é o resultado de expandir ou reduzir o retângulo especificado pelos valores especificados de largura e altura 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 estrutura Rect 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

Rect

O retângulo resultante.

Exceções

rect é um retângulo Empty.

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 em 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 o atual Width ou Height , dando ao retângulo uma área negativa, esse método retornará Rect.Empty.

Confira também

Aplica-se a