Rectangle.Inflate Metoda
Definicja
Ważne
Niektóre informacje odnoszą się do produktu w wersji wstępnej, który może zostać znacząco zmodyfikowany przed wydaniem. Firma Microsoft nie udziela żadnych gwarancji, jawnych lub domniemanych, w odniesieniu do informacji podanych w tym miejscu.
Rectangle Powiększa strukturę o określoną kwotę.
Przeciążenia
Inflate(Size) |
Powiększa to Rectangle o określoną kwotę. |
Inflate(Int32, Int32) |
Powiększa to Rectangle o określoną kwotę. |
Inflate(Rectangle, Int32, Int32) |
Tworzy i zwraca powiększoną kopię określonej Rectangle struktury. Kopia jest powiększona o określoną kwotę. Oryginalna Rectangle struktura pozostaje niezmodyfikowana. |
Inflate(Size)
- Źródło:
- Rectangle.cs
- Źródło:
- Rectangle.cs
- Źródło:
- Rectangle.cs
Powiększa to 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 do zawyżania tego prostokąta.
Przykłady
Poniższy przykład jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgse
parametru Paint programu obsługi zdarzeń. 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 mieć długość 150 jednostek (oryginalny 50, 50 w kierunku minus, a 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
Powiększa to 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 Rectangle strukturę 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 mieć długość 150 jednostek (oryginalny 50, 50 w kierunku minus, a 50 w kierunku plus) utrzymujący środek geometryczny prostokąta.
Jeśli albo x
y
jest ujemna, Rectangle struktura 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
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 Rectangleelement .
Przykłady
Poniższy przykład jest przeznaczony do użycia z Windows Forms i wymaga PaintEventArgse
parametru Paint programu obsługi zdarzeń. Kod tworzy Rectangle i powiększa go o 50 jednostek w obu osiach. Zwróć uwagę, że wynikowy prostokąt (czerwony) to 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 mieć długość 150 jednostek (oryginalny 50, 50 w kierunku minus, a 50 w kierunku plus) utrzymujący środek geometryczny prostokąta.
Dotyczy
Opinia
https://aka.ms/ContentUserFeedback.
Dostępne już wkrótce: W 2024 r. będziemy stopniowo wycofywać zgłoszenia z serwisu GitHub jako mechanizm przesyłania opinii na temat zawartości i zastępować go nowym systemem opinii. Aby uzyskać więcej informacji, sprawdź:Prześlij i wyświetl opinię dla