Rect.Inflate Methode

Definition

Erstellt ein Rechteck, das sich aus dem Erweitern oder Verkleinern eines Rechtecks um den angegebenen Betrag ergibt.

Überlädt

Name Beschreibung
Inflate(Size)

Erweitert das Rechteck mithilfe des angegebenen SizeRechtecks in alle Richtungen.

Inflate(Double, Double)

Erweitert oder verkleinert das Rechteck mithilfe der angegebenen Breite und Höhe in alle Richtungen.

Inflate(Rect, Size)

Gibt das Rechteck zurück, das aus der Erweiterung des angegebenen Rechtecks durch das angegebene SizeRechteck in allen Richtungen resultiert.

Inflate(Rect, Double, Double)

Erstellt ein Rechteck, das aus dem Erweitern oder Verkleinern des angegebenen Rechtecks durch die angegebenen Breiten- und Höhenbeträge in allen Richtungen resultiert.

Inflate(Size)

Erweitert das Rechteck mithilfe des angegebenen SizeRechtecks in alle Richtungen.

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)

Parameter

size
Size

Gibt den Betrag an, um das Rechteck zu erweitern. Die Size Eigenschaft der Width Struktur gibt den Betrag an, um die Eigenschaften und Left Eigenschaften des Rechtecks Right zu erhöhen. Die Size Eigenschaft der Height Struktur gibt den Betrag an, um die Eigenschaften und Top Eigenschaften des Rechtecks Bottom zu erhöhen.

Ausnahmen

Diese Methode wird für das Empty Rechteck aufgerufen.

Beispiele

Das folgende Beispiel zeigt, wie Sie die Inflate(Size) Methode verwenden, um die Größe eines Rechtecks zu erhöhen.

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

Hinweise

Das Width resultierende Rechteck wird um zweimal der Width angegebenen Size Struktur erhöht, da sowohl die linke als auch die rechte Seite des Rechtecks aufgeblasen sind. Ebenso wird das Height resultierende Rechteck um zweimal der Height angegebenen Size Struktur erhöht.

Weitere Informationen

Gilt für:

Inflate(Double, Double)

Erweitert oder verkleinert das Rechteck mithilfe der angegebenen Breite und Höhe in alle Richtungen.

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)

Parameter

width
Double

Der Betrag, um den die linke und rechte Seite des Rechtecks erweitert oder verkleinern soll.

height
Double

Der Betrag, um den die oberen und unteren Seiten des Rechtecks erweitert oder verkleinern sollen.

Ausnahmen

Diese Methode wird für das Empty Rechteck aufgerufen.

Beispiele

Das folgende Beispiel zeigt, wie Sie die Inflate(Double, Double) Methode verwenden, um die Größe eines Rechtecks zu ändern.

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

Hinweise

Das Width resultierende Rechteck wird um zweimal den angegebenen Breitenversatz erhöht oder verringert, da es sowohl auf die linke als auch auf die rechte Seite des Rechtecks angewendet wird. Ebenso wird das Height resultierende Rechteck um zweimal die angegebene Höhe erhöht oder verringert.

Wenn die angegebene Breite oder Höhe das Rechteck um mehr als sein aktuelles Width oder Height - das Rechteck einen negativen Bereich - verkleinern, wird das Rechteck zum Empty Rechteck.

Weitere Informationen

Gilt für:

Inflate(Rect, Size)

Gibt das Rechteck zurück, das aus der Erweiterung des angegebenen Rechtecks durch das angegebene SizeRechteck in allen Richtungen resultiert.

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

Parameter

rect
Rect

Die Rect zu ändernde Struktur.

size
Size

Gibt den Betrag an, um das Rechteck zu erweitern. Die Size Eigenschaft der Width Struktur gibt den Betrag an, um die Eigenschaften und Left Eigenschaften des Rechtecks Right zu erhöhen. Die Size Eigenschaft der Height Struktur gibt den Betrag an, um die Eigenschaften und Top Eigenschaften des Rechtecks Bottom zu erhöhen.

Gibt zurück

Das resultierende Rechteck.

Ausnahmen

rect ist ein Empty Rechteck.

Beispiele

Das folgende Beispiel zeigt, wie Sie die Inflate(Rect, Size) Methode verwenden, um die Größe eines Rechtecks zu ändern.

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

Hinweise

Das Width resultierende Rechteck wird um zweimal der Width angegebenen Size Struktur erhöht, da sowohl die linke als auch die rechte Seite des Rechtecks aufgeblasen sind. Ebenso wird das Height resultierende Rechteck um zweimal der Height angegebenen Size Struktur erhöht.

Weitere Informationen

Gilt für:

Inflate(Rect, Double, Double)

Erstellt ein Rechteck, das aus dem Erweitern oder Verkleinern des angegebenen Rechtecks durch die angegebenen Breiten- und Höhenbeträge in allen Richtungen resultiert.

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

Parameter

rect
Rect

Die Rect zu ändernde Struktur.

width
Double

Der Betrag, um den die linke und rechte Seite des Rechtecks erweitert oder verkleinern soll.

height
Double

Der Betrag, um den die oberen und unteren Seiten des Rechtecks erweitert oder verkleinern sollen.

Gibt zurück

Das resultierende Rechteck.

Ausnahmen

rect ist ein Empty Rechteck.

Beispiele

Das folgende Beispiel zeigt, wie Sie die Inflate(Rect, Double, Double) Methode verwenden, um die Größe eines Rechtecks zu ändern.

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

Hinweise

Das Width resultierende Rechteck wird um zweimal den angegebenen Breitenversatz erhöht oder verringert, da es sowohl auf die linke als auch auf die rechte Seite des Rechtecks angewendet wird. Ebenso wird das Height resultierende Rechteck um zweimal die angegebene Höhe erhöht oder verringert.

Wenn die angegebenen Breiten- oder Höhenmodifizierer das Rechteck um mehr als den aktuellen Width Wert verkleinern oder Height - was dem Rechteck einen negativen Bereich gibt - gibt diese Methode zurück Rect.Empty.

Weitere Informationen

Gilt für: