Graphics.FillRectangle 메서드

정의

좌표 쌍, 너비 및 높이로 지정된 사각형의 내부에 의해 정의되는 사각형의 내부를 채웁니다.

오버로드

FillRectangle(Brush, Rectangle)

Rectangle 구조체의 의해 지정된 사각형의 내부를 채웁니다.

FillRectangle(Brush, RectangleF)

RectangleF 구조체의 의해 지정된 사각형의 내부를 채웁니다.

FillRectangle(Brush, Int32, Int32, Int32, Int32)

좌표 쌍, 너비 및 높이로 지정된 사각형의 내부에 의해 정의되는 사각형의 내부를 채웁니다.

FillRectangle(Brush, Single, Single, Single, Single)

좌표 쌍, 너비 및 높이로 지정된 사각형의 내부에 의해 정의되는 사각형의 내부를 채웁니다.

FillRectangle(Brush, Rectangle)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

Rectangle 구조체의 의해 지정된 사각형의 내부를 채웁니다.

public:
 void FillRectangle(System::Drawing::Brush ^ brush, System::Drawing::Rectangle rect);
public void FillRectangle (System.Drawing.Brush brush, System.Drawing.Rectangle rect);
member this.FillRectangle : System.Drawing.Brush * System.Drawing.Rectangle -> unit
Public Sub FillRectangle (brush As Brush, rect As Rectangle)

매개 변수

brush
Brush

채우기의 특징을 결정하는 Brush입니다.

rect
Rectangle

채울 사각형을 나타내는 Rectangle 구조체입니다.

예외

brush이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 단색 파란색 브러시를 만듭니다.

  • 사각형을 만듭니다.

  • 화면의 사각형 영역을 채웁니다.

public:
   void FillRectangleRectangle( PaintEventArgs^ e )
   {
      // Create solid brush.
      SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue );

      // Create rectangle.
      Rectangle rect = Rectangle(0,0,200,200);

      // Fill rectangle to screen.
      e->Graphics->FillRectangle( blueBrush, rect );
   }
private void FillRectangleRectangle(PaintEventArgs e)
{

    // Create solid brush.
    SolidBrush blueBrush = new SolidBrush(Color.Blue);

    // Create rectangle.
    Rectangle rect = new Rectangle(0, 0, 200, 200);

    // Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, rect);
}
Private Sub FillRectangleRectangle(ByVal e As PaintEventArgs)

    ' Create solid brush.
    Dim blueBrush As New SolidBrush(Color.Blue)

    ' Create rectangle.
    Dim rect As New Rectangle(0, 0, 200, 200)

    ' Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, rect)
End Sub

설명

이 메서드는 지정된 왼쪽 위 모서리와 계산된 아래쪽 가장자리까지 매개 변수로 정의된 rect 사각형의 내부를 채웁니다.

적용 대상

FillRectangle(Brush, RectangleF)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

RectangleF 구조체의 의해 지정된 사각형의 내부를 채웁니다.

public:
 void FillRectangle(System::Drawing::Brush ^ brush, System::Drawing::RectangleF rect);
public void FillRectangle (System.Drawing.Brush brush, System.Drawing.RectangleF rect);
member this.FillRectangle : System.Drawing.Brush * System.Drawing.RectangleF -> unit
Public Sub FillRectangle (brush As Brush, rect As RectangleF)

매개 변수

brush
Brush

채우기의 특징을 결정하는 Brush입니다.

rect
RectangleF

채울 사각형을 나타내는 RectangleF 구조체입니다.

예외

brush이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 단색 파란색 브러시를 만듭니다.

  • 사각형을 만듭니다.

  • 화면의 사각형 영역을 채웁니다.

public:
   void FillRectangleRectangleF( PaintEventArgs^ e )
   {
      // Create solid brush.
      SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue );

      // Create rectangle.
      RectangleF rect = RectangleF(0.0F,0.0F,200.0F,200.0F);

      // Fill rectangle to screen.
      e->Graphics->FillRectangle( blueBrush, rect );
   }
private void FillRectangleRectangleF(PaintEventArgs e)
{

    // Create solid brush.
    SolidBrush blueBrush = new SolidBrush(Color.Blue);

    // Create rectangle.
    RectangleF rect = new RectangleF(0.0F, 0.0F, 200.0F, 200.0F);

    // Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, rect);
}
Private Sub FillRectangleRectangleF(ByVal e As PaintEventArgs)

    ' Create solid brush.
    Dim blueBrush As New SolidBrush(Color.Blue)

    ' Create rectangle.
    Dim rect As New RectangleF(0.0F, 0.0F, 200.0F, 200.0F)

    ' Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, rect)
End Sub

설명

이 메서드는 지정된 왼쪽 위 모서리와 계산된 아래쪽 가장자리까지 매개 변수로 정의된 rect 사각형의 내부를 채웁니다.

적용 대상

FillRectangle(Brush, Int32, Int32, Int32, Int32)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

좌표 쌍, 너비 및 높이로 지정된 사각형의 내부에 의해 정의되는 사각형의 내부를 채웁니다.

public:
 void FillRectangle(System::Drawing::Brush ^ brush, int x, int y, int width, int height);
public void FillRectangle (System.Drawing.Brush brush, int x, int y, int width, int height);
member this.FillRectangle : System.Drawing.Brush * int * int * int * int -> unit
Public Sub FillRectangle (brush As Brush, x As Integer, y As Integer, width As Integer, height As Integer)

매개 변수

brush
Brush

채우기의 특징을 결정하는 Brush입니다.

x
Int32

채울 사각형의 왼쪽 위 모퉁이에 대한 X좌표입니다.

y
Int32

채울 사각형의 왼쪽 위 모퉁이에 대한 Y좌표입니다.

width
Int32

채울 사각형의 너비입니다.

height
Int32

채울 사각형의 높이입니다.

예외

brush이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 단색 파란색 브러시를 만듭니다.

  • 사각형의 위치와 크기를 만듭니다.

  • 화면의 사각형 영역을 채웁니다.

public:
   void FillRectangleInt( PaintEventArgs^ e )
   {
      // Create solid brush.
      SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue );

      // Create location and size of rectangle.
      int x = 0;
      int y = 0;
      int width = 200;
      int height = 200;

      // Fill rectangle to screen.
      e->Graphics->FillRectangle( blueBrush, x, y, width, height );
   }
private void FillRectangleInt(PaintEventArgs e)
{

    // Create solid brush.
    SolidBrush blueBrush = new SolidBrush(Color.Blue);

    // Create location and size of rectangle.
    int x = 0;
    int y = 0;
    int width = 200;
    int height = 200;

    // Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, x, y, width, height);
}
Private Sub FillRectangleInt(ByVal e As PaintEventArgs)

    ' Create solid brush.
    Dim blueBrush As New SolidBrush(Color.Blue)

    ' Create location and size of rectangle.
    Dim x As Integer = 0
    Dim y As Integer = 0
    Dim width As Integer = 200
    Dim height As Integer = 200

    ' Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, x, y, width, height)
End Sub

설명

이 메서드는 지정된 왼쪽 위 모서리와 계산된 아래쪽 가장자리까지, , widthheight 매개 변수로 정의된xy 사각형의 내부를 채웁니다.

적용 대상

FillRectangle(Brush, Single, Single, Single, Single)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

좌표 쌍, 너비 및 높이로 지정된 사각형의 내부에 의해 정의되는 사각형의 내부를 채웁니다.

public:
 void FillRectangle(System::Drawing::Brush ^ brush, float x, float y, float width, float height);
public void FillRectangle (System.Drawing.Brush brush, float x, float y, float width, float height);
member this.FillRectangle : System.Drawing.Brush * single * single * single * single -> unit
Public Sub FillRectangle (brush As Brush, x As Single, y As Single, width As Single, height As Single)

매개 변수

brush
Brush

채우기의 특징을 결정하는 Brush입니다.

x
Single

채울 사각형의 왼쪽 위 모퉁이에 대한 X좌표입니다.

y
Single

채울 사각형의 왼쪽 위 모퉁이에 대한 Y좌표입니다.

width
Single

채울 사각형의 너비입니다.

height
Single

채울 사각형의 높이입니다.

예외

brush이(가) null인 경우

예제

다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

  • 단색 파란색 브러시를 만듭니다.

  • 사각형의 위치와 크기를 만듭니다.

  • 화면의 사각형 영역을 채웁니다.

public:
   void FillRectangleFloat( PaintEventArgs^ e )
   {
      // Create solid brush.
      SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue );

      // Create location and size of rectangle.
      float x = 0.0F;
      float y = 0.0F;
      float width = 200.0F;
      float height = 200.0F;

      // Fill rectangle to screen.
      e->Graphics->FillRectangle( blueBrush, x, y, width, height );
   }
private void FillRectangleFloat(PaintEventArgs e)
{

    // Create solid brush.
    SolidBrush blueBrush = new SolidBrush(Color.Blue);

    // Create location and size of rectangle.
    float x = 0.0F;
    float y = 0.0F;
    float width = 200.0F;
    float height = 200.0F;

    // Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, x, y, width, height);
}
Private Sub FillRectangleFloat(ByVal e As PaintEventArgs)

    ' Create solid brush.
    Dim blueBrush As New SolidBrush(Color.Blue)

    ' Create location and size of rectangle.
    Dim x As Single = 0.0F
    Dim y As Single = 0.0F
    Dim width As Single = 200.0F
    Dim height As Single = 200.0F

    ' Fill rectangle to screen.
    e.Graphics.FillRectangle(blueBrush, x, y, width, height)
End Sub

설명

이 메서드는 지정된 왼쪽 위 모서리와 계산된 아래쪽 가장자리까지 , y, widthheight 매개 변수로 정의된 x사각형의 내부를 채웁니다.

적용 대상