Rect.Inflate Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Crea un rettangolo risultante dall'espansione o dalla compattazione di un rettangolo in base alla quantità specificata.
Overload
| Nome | Descrizione |
|---|---|
| Inflate(Size) |
Espande il rettangolo usando l'oggetto specificato Sizein tutte le direzioni. |
| Inflate(Double, Double) |
Espande o riduce il rettangolo utilizzando gli importi di larghezza e altezza specificati, in tutte le direzioni. |
| Inflate(Rect, Size) |
Restituisce il rettangolo risultante dall'espansione del rettangolo specificato dall'oggetto specificato Sizein tutte le direzioni. |
| Inflate(Rect, Double, Double) |
Crea un rettangolo risultante dall'espansione o dalla compattazione del rettangolo specificato in base alla larghezza e all'altezza specificate, in tutte le direzioni. |
Inflate(Size)
Espande il rettangolo usando l'oggetto specificato Sizein tutte le direzioni.
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)
Parametri
- size
- Size
Specifica la quantità di espansione del rettangolo. La Size proprietà della Width struttura specifica la quantità di aumento delle proprietà e Left del Right rettangolo. La Size proprietà della Height struttura specifica la quantità di aumento delle proprietà e Top del Bottom rettangolo.
Eccezioni
Questo metodo viene chiamato sul Empty rettangolo.
Esempio
Nell'esempio seguente viene illustrato come utilizzare il Inflate(Size) metodo per aumentare le dimensioni di un rettangolo.
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;
}
Commenti
L'oggetto Width del rettangolo risultante viene aumentato di due volte rispetto alla Width struttura specificata Size , perché entrambi i lati sinistro e destro del rettangolo vengono gonfiati. Analogamente, l'oggetto Height del rettangolo risultante viene aumentato del doppio della Height struttura specificata Size .
Vedi anche
Si applica a
Inflate(Double, Double)
Espande o riduce il rettangolo utilizzando gli importi di larghezza e altezza specificati, in tutte le direzioni.
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)
Parametri
- width
- Double
Quantità in base alla quale espandere o compattare i lati sinistro e destro del rettangolo.
- height
- Double
Quantità in base alla quale espandere o compattare i lati superiore e inferiore del rettangolo.
Eccezioni
Questo metodo viene chiamato sul Empty rettangolo.
Esempio
Nell'esempio seguente viene illustrato come usare il Inflate(Double, Double) metodo per modificare le dimensioni di un rettangolo.
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;
}
Commenti
L'oggetto Width del rettangolo risultante viene aumentato o diminuito di due volte l'offset di larghezza specificato, perché viene applicato sia ai lati sinistro che destro del rettangolo. Analogamente, l'oggetto Height del rettangolo risultante viene aumentato o ridotto di due volte l'altezza specificata.
Se la larghezza o l'altezza specificata compattano il rettangolo in base al valore corrente Width o Height , assegnando al rettangolo un'area negativa, il rettangolo diventa il Empty rettangolo.
Vedi anche
Si applica a
Inflate(Rect, Size)
Restituisce il rettangolo risultante dall'espansione del rettangolo specificato dall'oggetto specificato Sizein tutte le direzioni.
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
Parametri
- size
- Size
Specifica la quantità di espansione del rettangolo. La Size proprietà della Width struttura specifica la quantità di aumento delle proprietà e Left del Right rettangolo. La Size proprietà della Height struttura specifica la quantità di aumento delle proprietà e Top del Bottom rettangolo.
Valori restituiti
Rettangolo risultante.
Eccezioni
rect è un Empty rettangolo.
Esempio
Nell'esempio seguente viene illustrato come usare il Inflate(Rect, Size) metodo per modificare le dimensioni di un rettangolo.
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;
}
Commenti
L'oggetto Width del rettangolo risultante viene aumentato di due volte rispetto alla Width struttura specificata Size , perché entrambi i lati sinistro e destro del rettangolo vengono gonfiati. Analogamente, l'oggetto Height del rettangolo risultante viene aumentato del doppio della Height struttura specificata Size .
Vedi anche
Si applica a
Inflate(Rect, Double, Double)
Crea un rettangolo risultante dall'espansione o dalla compattazione del rettangolo specificato in base alla larghezza e all'altezza specificate, in tutte le direzioni.
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
Parametri
- width
- Double
Quantità in base alla quale espandere o compattare i lati sinistro e destro del rettangolo.
- height
- Double
Quantità in base alla quale espandere o compattare i lati superiore e inferiore del rettangolo.
Valori restituiti
Rettangolo risultante.
Eccezioni
rect è un Empty rettangolo.
Esempio
Nell'esempio seguente viene illustrato come usare il Inflate(Rect, Double, Double) metodo per modificare le dimensioni di un rettangolo.
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;
}
Commenti
L'oggetto Width del rettangolo risultante viene aumentato o diminuito di due volte l'offset di larghezza specificato, perché viene applicato sia ai lati sinistro che destro del rettangolo. Analogamente, l'oggetto Height del rettangolo risultante viene aumentato o ridotto di due volte l'altezza specificata.
Se i modificatori di larghezza o altezza specificati compattano il rettangolo in base al valore corrente Width o Height , assegnando al rettangolo un'area negativa, questo metodo restituisce Rect.Empty.