Partager via


Rect.Inflate Méthode

Définition

Crée un rectangle qui résulte du développement ou de la réduction d'un rectangle par le taux spécifié.

Surcharges

Inflate(Size)

Développe le rectangle en utilisant la Sizespécifiée, dans toutes les directions.

Inflate(Double, Double)

Développe ou réduit le rectangle en utilisant les taux de largeur et de hauteur spécifiés, dans toutes les directions.

Inflate(Rect, Size)

Renvoie le rectangle qui résulte du développement du rectangle spécifié par la Sizespécifiée, dans toutes les directions.

Inflate(Rect, Double, Double)

Crée un rectangle qui résulte du développement ou de la réduction du rectangle spécifié par les taux de largeur ou de hauteur spécifiés, dans toutes les directions.

Inflate(Size)

Développe le rectangle en utilisant la Sizespécifiée, dans toutes les directions.

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)

Paramètres

size
Size

Spécifie le taux de développement du rectangle. La propriété Size de la structure Width spécifie la valeur à laquelle augmenter les propriétés Left et Right du rectangle. La propriété Size de la structure Height spécifie la valeur à laquelle augmenter les propriétés Top et Bottom du rectangle.

Exceptions

Cette méthode est appelée sur le rectangle Empty.

Exemples

L’exemple suivant montre comment utiliser la Inflate(Size) méthode pour augmenter la taille d’un rectangle.

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;
}

Remarques

Le Width rectangle résultant est augmenté de deux fois la Width structure spécifiée Size , car les côtés gauche et droit du rectangle sont gonflés. De même, le Height rectangle résultant est augmenté de deux fois par la Height structure spécifiée Size .

Voir aussi

S’applique à

Inflate(Double, Double)

Développe ou réduit le rectangle en utilisant les taux de largeur et de hauteur spécifiés, dans toutes les directions.

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)

Paramètres

width
Double

Le taux de développement ou de réduction des côtés gauche et droit d'un rectangle.

height
Double

Le taux de développement ou de réduction du haut et du bas d'un rectangle.

Exceptions

Cette méthode est appelée sur le rectangle Empty.

Exemples

L’exemple suivant montre comment utiliser la Inflate(Double, Double) méthode pour modifier la taille d’un rectangle.

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;
}

Remarques

Le Width rectangle résultant est augmenté ou diminué par deux fois le décalage de largeur spécifié, car il est appliqué à la fois aux côtés gauche et droit du rectangle. De même, le Height rectangle résultant est augmenté ou diminué par deux fois la hauteur spécifiée.

Si la largeur ou la hauteur spécifiée réduisent le rectangle de plus que son courant Width ou Height - donnant au rectangle une zone négative - le rectangle devient le Empty rectangle.

Voir aussi

S’applique à

Inflate(Rect, Size)

Renvoie le rectangle qui résulte du développement du rectangle spécifié par la Sizespécifiée, dans toutes les directions.

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

Paramètres

rect
Rect

La structure Rect à modifier.

size
Size

Spécifie le taux de développement du rectangle. La propriété Size de la structure Width spécifie la valeur à laquelle augmenter les propriétés Left et Right du rectangle. La propriété Size de la structure Height spécifie la valeur à laquelle augmenter les propriétés Top et Bottom du rectangle.

Retours

Rect

Le rectangle résultant.

Exceptions

rect est un rectangle Empty.

Exemples

L’exemple suivant montre comment utiliser la Inflate(Rect, Size) méthode pour modifier la taille d’un rectangle.

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;
}

Remarques

Le Width rectangle résultant est augmenté de deux fois la Width structure spécifiée Size , car les côtés gauche et droit du rectangle sont gonflés. De même, le Height rectangle résultant est augmenté de deux fois par la Height structure spécifiée Size .

Voir aussi

S’applique à

Inflate(Rect, Double, Double)

Crée un rectangle qui résulte du développement ou de la réduction du rectangle spécifié par les taux de largeur ou de hauteur spécifiés, dans toutes les directions.

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

Paramètres

rect
Rect

La structure Rect à modifier.

width
Double

Le taux de développement ou de réduction des côtés gauche et droit d'un rectangle.

height
Double

Le taux de développement ou de réduction du haut et du bas d'un rectangle.

Retours

Rect

Le rectangle résultant.

Exceptions

rect est un rectangle Empty.

Exemples

L’exemple suivant montre comment utiliser la Inflate(Rect, Double, Double) méthode pour modifier la taille d’un rectangle.

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;
}

Remarques

Le Width rectangle résultant est augmenté ou diminué par deux fois le décalage de largeur spécifié, car il est appliqué à la fois aux côtés gauche et droit du rectangle. De même, le Height rectangle résultant est augmenté ou diminué par deux fois la hauteur spécifiée.

Si les modificateurs de largeur ou de hauteur spécifiés réduisent le rectangle de plus que son actuel Width ou Height - donnant au rectangle une zone négative - cette méthode retourne Rect.Empty.

Voir aussi

S’applique à