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 la quantité spécifiée.

Surcharges

Nom Description
Inflate(Size)

Développe le rectangle à l’aide de l’élément spécifié Size, dans toutes les directions.

Inflate(Double, Double)

Développe ou réduit le rectangle à l’aide des quantités de largeur et de hauteur spécifiées, dans toutes les directions.

Inflate(Rect, Size)

Retourne le rectangle qui résulte du développement du rectangle spécifié par le rectangle spécifié Size, 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 quantités de largeur et de hauteur spécifiées, dans toutes les directions.

Inflate(Size)

Développe le rectangle à l’aide de l’élément spécifié Size, 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 la quantité à développer le rectangle. La Size propriété de Width la structure spécifie la quantité à augmenter les propriétés et Left les propriétés du Right rectangle. La Size propriété de Height la structure spécifie la quantité à augmenter les propriétés et Top les propriétés du Bottom rectangle.

Exceptions

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

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é par 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 à l’aide des quantités de largeur et de hauteur spécifiées, 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

Quantité par laquelle développer ou réduire les côtés gauche et droit du rectangle.

height
Double

Quantité par laquelle développer ou réduire les côtés supérieur et inférieur du rectangle.

Exceptions

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

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 en plus de 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)

Retourne le rectangle qui résulte du développement du rectangle spécifié par le rectangle spécifié Size, 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

Structure Rect à modifier.

size
Size

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

Retours

Rectangle résultant.

Exceptions

rect est un Empty rectangle.

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é par 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 quantités de largeur et de hauteur spécifiées, 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

Structure Rect à modifier.

width
Double

Quantité par laquelle développer ou réduire les côtés gauche et droit du rectangle.

height
Double

Quantité par laquelle développer ou réduire les côtés supérieur et inférieur du rectangle.

Retours

Rectangle résultant.

Exceptions

rect est un Empty rectangle.

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 par plus que son courant Width ou Height - donnant au rectangle une zone négative - cette méthode retourne Rect.Empty.

Voir aussi

S’applique à