Rectangle.Inflate 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
Rectangle 구조체를 지정된 크기만큼 확대합니다.
오버로드
| Inflate(Size) |
이 Rectangle을 지정된 크기만큼 확대합니다. |
| Inflate(Int32, Int32) |
이 Rectangle을 지정된 크기만큼 확대합니다. |
| Inflate(Rectangle, Int32, Int32) |
지정된 Rectangle 구조체의 확대된 복사본을 만들고 반환합니다. 복사본은 지정된 크기만큼 확대됩니다. 원래의 Rectangle 구조체는 수정되지 않고 남습니다. |
Inflate(Size)
이 Rectangle을 지정된 크기만큼 확대합니다.
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)
매개 변수
- size
- Size
이 사각형을 확장할 크기입니다.
예제
다음 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 매개 변수인 이 매개 변수가 Paint 필요합니다 PaintEventArgs e. 이 코드는 두 축에서 50단위씩 확대하여 만듭니 Rectangle 다. 사각형은 인플레이션(검은색)과 인플레이션(빨간색) 후 화면에 그려집니다.
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
설명
이 메서드는 복사본이 아니라 이 사각형을 확대합니다. 사각형은 축을 따라 양방향으로 확대됩니다. 예를 들어 x축에서 50 x 50 사각형이 50으로 확대되면 결과 사각형의 길이는 150단위(원래 50개, 빼기 방향의 50개 및 더하기 방향의 50)가 되어 사각형의 기하학적 중심을 유지합니다.
적용 대상
Inflate(Int32, Int32)
이 Rectangle을 지정된 크기만큼 확대합니다.
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)
매개 변수
예제
다음 예제에서는 구조를 만들고 Rectangle x축 방향으로 100단위씩 확대합니다.
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
설명
이 메서드는 복사본이 아니라 이 사각형을 확대합니다. 사각형은 축을 따라 양방향으로 확대됩니다. 예를 들어 x축에서 50 x 50 사각형이 50으로 확대되면 결과 사각형의 길이는 150단위(원래 50개, 빼기 방향의 50개 및 더하기 방향의 50)가 되어 사각형의 기하학적 중심을 유지합니다.
음수이거나 x y 음수 Rectangle 이면 구조체가 해당 방향으로 수축됩니다.
적용 대상
Inflate(Rectangle, Int32, Int32)
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
매개 변수
반환
확대된 Rectangle입니다.
예제
다음 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 매개 변수인 이 매개 변수가 Paint 필요합니다 PaintEventArgs e. 이 코드는 두 축 모두에서 50단위 단위로 a를 만들고 Rectangle 확대합니다. 결과 사각형(빨간색)은 두 축 모두에서 150단위입니다.
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
설명
이 메서드는 복사본 rect을 만들고 복사본을 확대한 다음 확대된 복사본을 반환합니다. 사각형은 축을 따라 양방향으로 확대됩니다. 예를 들어 x축에서 50 x 50 사각형이 50으로 확대되는 경우 결과 사각형은 직사각형의 기하 중심을 유지 관리하는 150단위 길이(원래 50, 빼기 방향의 50 및 더하기 방향의 50)가 됩니다.