Rectangle.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.
Ingrandisce una struttura Rectangle in base al valore specificato.
Overload
Inflate(Size) |
Ingrandisce l'oggetto Rectangle in base al valore specificato. |
Inflate(Int32, Int32) |
Ingrandisce l'oggetto Rectangle in base al valore specificato. |
Inflate(Rectangle, Int32, Int32) |
Crea e restituisce una copia ingrandita della struttura Rectangle specificata. La copia viene ingrandita in base al valore specificato. La struttura Rectangle originale resta invariata. |
Inflate(Size)
- Origine:
- Rectangle.cs
- Origine:
- Rectangle.cs
- Origine:
- Rectangle.cs
Ingrandisce l'oggetto Rectangle in base al valore specificato.
public:
void Inflate(System::Drawing::Size size);
public void Inflate (System.Drawing.Size size);
member this.Inflate : System.Drawing.Size -> unit
Public Sub Inflate (size As Size)
Parametri
- size
- Size
Valore di ingrandimento del rettangolo.
Esempio
L'esempio seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse
, che è un parametro del Paint gestore eventi. Il codice crea un oggetto Rectangle e lo espande di 50 unità in entrambi gli assi. Il rettangolo viene disegnato sullo schermo prima dell'inflazione (nero) e dopo l'inflazione (rosso).
public:
void RectangleInflateTest2( PaintEventArgs^ e )
{
// Create a rectangle.
Rectangle rect = Rectangle(100,100,50,50);
// Draw the uninflated rectangle to screen.
e->Graphics->DrawRectangle( Pens::Black, rect );
// Set up the inflate size.
System::Drawing::Size inflateSize = System::Drawing::Size( 50, 50 );
// Call Inflate.
rect.Inflate( inflateSize );
// Draw the inflated rectangle to screen.
e->Graphics->DrawRectangle( Pens::Red, rect );
}
public void RectangleInflateTest2(PaintEventArgs e)
{
// Create a rectangle.
Rectangle rect = new Rectangle(100, 100, 50, 50);
// Draw the uninflated rectangle to screen.
e.Graphics.DrawRectangle(Pens.Black, rect);
// Set up the inflate size.
Size inflateSize = new Size(50, 50);
// Call Inflate.
rect.Inflate(inflateSize);
// Draw the inflated rectangle to screen.
e.Graphics.DrawRectangle(Pens.Red, rect);
}
Public Sub RectangleInflateTest2(ByVal e As PaintEventArgs)
' Create a rectangle.
Dim rect As New Rectangle(100, 100, 50, 50)
' Draw the uninflated rect to screen.
e.Graphics.DrawRectangle(Pens.Black, rect)
' Set up the inflate size.
Dim inflateSize As New Size(50, 50)
' Call Inflate.
rect.Inflate(inflateSize)
' Draw the inflated rect to screen.
e.Graphics.DrawRectangle(Pens.Red, rect)
End Sub
Commenti
Questo metodo espande questo rettangolo, non una copia di esso. Il rettangolo viene ampliato in entrambe le direzioni lungo un asse. Ad esempio, se un rettangolo da 50 a 50 viene ampliato per 50 nell'asse x, il rettangolo risultante sarà lungo 150 unità (il 50 originale, il 50 nella direzione meno e il 50 nella direzione più) mantenendo il centro geometrico del rettangolo.
Si applica a
Inflate(Int32, Int32)
- Origine:
- Rectangle.cs
- Origine:
- Rectangle.cs
- Origine:
- Rectangle.cs
Ingrandisce l'oggetto Rectangle in base al valore specificato.
public:
void Inflate(int width, int height);
public void Inflate (int width, int height);
member this.Inflate : int * int -> unit
Public Sub Inflate (width As Integer, height As Integer)
Parametri
Esempio
Nell'esempio seguente viene creata una Rectangle struttura e la si espande di 100 unità nella direzione dell'asse x:
public:
void RectangleInflateTest3( PaintEventArgs^ e )
{
// Create a rectangle.
Rectangle rect = Rectangle(100,100,50,50);
// Draw the uninflated rectangle to screen.
e->Graphics->DrawRectangle( Pens::Black, rect );
// Call Inflate.
rect.Inflate( 50, 50 );
// Draw the inflated rectangle to screen.
e->Graphics->DrawRectangle( Pens::Red, rect );
}
public void RectangleInflateTest3(PaintEventArgs e)
{
// Create a rectangle.
Rectangle rect = new Rectangle(100, 100, 50, 50);
// Draw the uninflated rectangle to screen.
e.Graphics.DrawRectangle(Pens.Black, rect);
// Call Inflate.
rect.Inflate(50, 50);
// Draw the inflated rectangle to screen.
e.Graphics.DrawRectangle(Pens.Red, rect);
}
Public Sub RectangleInflateTest3(ByVal e As PaintEventArgs)
' Create a rectangle.
Dim rect As New Rectangle(100, 100, 50, 50)
' Draw the uninflated rectangle to screen.
e.Graphics.DrawRectangle(Pens.Black, rect)
' Call Inflate.
rect.Inflate(50, 50)
' Draw the inflated rectangle to screen.
e.Graphics.DrawRectangle(Pens.Red, rect)
End Sub
Commenti
Questo metodo espande questo rettangolo, non una copia di esso. Il rettangolo viene ampliato in entrambe le direzioni lungo un asse. Ad esempio, se un rettangolo da 50 a 50 viene ampliato per 50 nell'asse x, il rettangolo risultante sarà lungo 150 unità (il 50 originale, il 50 nella direzione meno e il 50 nella direzione più) mantenendo il centro geometrico del rettangolo.
x
Se o y
è negativo, la Rectangle struttura viene deflata nella direzione corrispondente.
Si applica a
Inflate(Rectangle, Int32, Int32)
- Origine:
- Rectangle.cs
- Origine:
- Rectangle.cs
- Origine:
- Rectangle.cs
public:
static System::Drawing::Rectangle Inflate(System::Drawing::Rectangle rect, int x, int y);
public static System.Drawing.Rectangle Inflate (System.Drawing.Rectangle rect, int x, int y);
static member Inflate : System.Drawing.Rectangle * int * int -> System.Drawing.Rectangle
Public Shared Function Inflate (rect As Rectangle, x As Integer, y As Integer) As Rectangle
Parametri
Restituisce
Rectangle ingrandito.
Esempio
L'esempio seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse
, che è un parametro del Paint gestore eventi. Il codice crea un oggetto Rectangle e lo espande di 50 unità in entrambi gli assi. Si noti che il rettangolo risultante (rosso) è 150 unità in entrambi gli assi.
public:
void RectangleInflateTest( PaintEventArgs^ e )
{
// Create a rectangle.
Rectangle rect = Rectangle(100,100,50,50);
// Draw the uninflated rectangle to screen.
e->Graphics->DrawRectangle( Pens::Black, rect );
// Call Inflate.
Rectangle rect2 = Rectangle::Inflate( rect, 50, 50 );
// Draw the inflated rectangle to screen.
e->Graphics->DrawRectangle( Pens::Red, rect2 );
}
public void RectangleInflateTest(PaintEventArgs e)
{
// Create a rectangle.
Rectangle rect = new Rectangle(100, 100, 50, 50);
// Draw the uninflated rectangle to screen.
e.Graphics.DrawRectangle(Pens.Black, rect);
// Call Inflate.
Rectangle rect2 = Rectangle.Inflate(rect, 50, 50);
// Draw the inflated rectangle to screen.
e.Graphics.DrawRectangle(Pens.Red, rect2);
}
Public Sub RectangleInflateTest(ByVal e As PaintEventArgs)
' Create a rectangle.
Dim rect As New Rectangle(100, 100, 50, 50)
' Draw the uninflated rectangle to screen.
e.Graphics.DrawRectangle(Pens.Black, rect)
' Call Inflate.
Dim rect2 As Rectangle = Rectangle.Inflate(rect, 50, 50)
' Draw the inflated rectangle to screen.
e.Graphics.DrawRectangle(Pens.Red, rect2)
End Sub
Commenti
Questo metodo crea una copia di rect
, espande la copia e quindi restituisce la copia ingrandita. Il rettangolo viene ampliato in entrambe le direzioni lungo un asse. Ad esempio, se un rettangolo da 50 a 50 viene ampliato per 50 nell'asse x, il rettangolo risultante sarà lungo 150 unità (il 50 originale, il 50 nella direzione meno e il 50 nella direzione più) mantenendo il centro geometrico del rettangolo.
Si applica a
Commenti e suggerimenti
https://aka.ms/ContentUserFeedback.
Presto disponibile: Nel corso del 2024 verranno gradualmente disattivati i problemi di GitHub come meccanismo di feedback per il contenuto e ciò verrà sostituito con un nuovo sistema di feedback. Per altre informazioni, vedereInvia e visualizza il feedback per