Rectangle.Inflate Metoda
Definicja
Ważny
Niektóre informacje dotyczą produktów przedpremierowych, które mogą zostać znacznie zmodyfikowane przed premierą. Microsoft nie udziela żadnych gwarancji, ani wyraźnych, ani domniemanych, dotyczących informacji podanych tutaj.
Powiększa Rectangle strukturę o określoną kwotę.
Przeciążenia
| Nazwa | Opis |
|---|---|
| Inflate(Size) |
Powiększa tę Rectangle o określoną kwotę. |
| Inflate(Int32, Int32) |
Powiększa tę Rectangle o określoną kwotę. |
| Inflate(Rectangle, Int32, Int32) |
Tworzy i zwraca powiększoną kopię określonej struktury Rectangle. Kopia jest powiększona o określoną kwotę. Oryginalna struktura Rectangle pozostaje niezmodyfikowana. |
Inflate(Size)
- Źródło:
- Rectangle.cs
- Źródło:
- Rectangle.cs
- Źródło:
- Rectangle.cs
- Źródło:
- Rectangle.cs
Powiększa tę Rectangle o określoną kwotę.
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)
Parametry
- size
- Size
Kwota, która ma zawyżać ten prostokąt.
Przykłady
Poniższy przykład jest przeznaczony do użycia z formularzami Systemu Windows i wymaga PaintEventArgse, który jest parametrem programu obsługi zdarzeń Paint. Kod tworzy Rectangle i powiększa go o 50 jednostek w obu osiach. Prostokąt jest przyciągany do ekranu przed inflacją (czarną) i po inflacji (czerwony).
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
Uwagi
Ta metoda powiększa ten prostokąt, a nie kopię. Prostokąt jest powiększony w obu kierunkach wzdłuż osi. Jeśli na przykład prostokąt 50 o 50 jest powiększony o 50 w osi x, wynikowy prostokąt będzie miał 150 jednostek długości (oryginalny 50, 50 w kierunku minus i 50 w kierunku plus) utrzymujący środek geometryczny prostokąta.
Dotyczy
Inflate(Int32, Int32)
- Źródło:
- Rectangle.cs
- Źródło:
- Rectangle.cs
- Źródło:
- Rectangle.cs
- Źródło:
- Rectangle.cs
Powiększa tę Rectangle o określoną kwotę.
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)
Parametry
Przykłady
Poniższy przykład tworzy strukturę Rectangle i powiększa ją o 100 jednostek w kierunku osi 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
Uwagi
Ta metoda powiększa ten prostokąt, a nie kopię. Prostokąt jest powiększony w obu kierunkach wzdłuż osi. Jeśli na przykład prostokąt 50 o 50 jest powiększony o 50 w osi x, wynikowy prostokąt będzie miał 150 jednostek długości (oryginalny 50, 50 w kierunku minus i 50 w kierunku plus) utrzymujący środek geometryczny prostokąta.
Jeśli x lub y jest ujemna, struktura Rectangle jest deflated w odpowiednim kierunku.
Dotyczy
Inflate(Rectangle, Int32, Int32)
- Źródło:
- Rectangle.cs
- Źródło:
- Rectangle.cs
- Źródło:
- Rectangle.cs
- Źródło:
- 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
Parametry
Zwraca
Powiększony Rectangle.
Przykłady
Poniższy przykład jest przeznaczony do użycia z formularzami Systemu Windows i wymaga PaintEventArgse, który jest parametrem programu obsługi zdarzeń Paint. Kod tworzy Rectangle i powiększa go o 50 jednostek w obu osiach. Zwróć uwagę, że wynikowy prostokąt (czerwony) wynosi 150 jednostek w obu osiach.
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
Uwagi
Ta metoda tworzy kopię rect, powiększa kopię, a następnie zwraca powiększoną kopię. Prostokąt jest powiększony w obu kierunkach wzdłuż osi. Jeśli na przykład prostokąt 50 o 50 jest powiększony o 50 w osi x, wynikowy prostokąt będzie miał 150 jednostek długości (oryginalny 50, 50 w kierunku minus i 50 w kierunku plus) utrzymujący środek geometryczny prostokąta.