Graphics.FillRegion(Brush, Region) 메서드

정의

Region의 내부를 채웁니다.Fills the interior of a Region.

public:
 void FillRegion(System::Drawing::Brush ^ brush, System::Drawing::Region ^ region);
public void FillRegion (System.Drawing.Brush brush, System.Drawing.Region region);
member this.FillRegion : System.Drawing.Brush * System.Drawing.Region -> unit
Public Sub FillRegion (brush As Brush, region As Region)

매개 변수

brush
Brush

채우기의 특징을 결정하는 Brush입니다.Brush that determines the characteristics of the fill.

region
Region

채울 영역을 나타내는 Region입니다.Region that represents the area to fill.

예외

brush이(가) null인 경우brush is null.

또는-or- region이(가) null인 경우region is null.

예제

다음 코드 예제는 Windows Forms와 함께 사용 하도록 설계 되었으며 PaintEventArgs e 이벤트 처리기의 매개 변수인가 필요 합니다 Paint .The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. 코드는 다음 작업을 수행 합니다.The code performs the following action:

  • 단색 파란색 브러시를 만듭니다.Creates a solid blue brush.

  • 사각형을 만듭니다.Creates a rectangle.

  • 사각형 영역을 만듭니다.Creates a rectangular region.

  • 화면의 사각형 영역을 채웁니다.Fills the rectangular region on the screen.

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

      // Create rectangle for region.
      Rectangle fillRect = Rectangle(100,100,200,200);

      // Create region for fill.
      System::Drawing::Region^ fillRegion = gcnew System::Drawing::Region( fillRect );

      // Fill region to screen.
      e->Graphics->FillRegion( blueBrush, fillRegion );
   }
private void FillRegionRectangle(PaintEventArgs e)
{

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

    // Create rectangle for region.
    Rectangle fillRect = new Rectangle(100, 100, 200, 200);

    // Create region for fill.
    Region fillRegion = new Region(fillRect);

    // Fill region to screen.
    e.Graphics.FillRegion(blueBrush, fillRegion);
}
Private Sub FillRegionRectangle(ByVal e As PaintEventArgs)

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

    ' Create rectangle for region.
    Dim fillRect As New Rectangle(100, 100, 200, 200)

    ' Create region for fill.
    Dim fillRegion As New [Region](fillRect)

    ' Fill region to screen.
    e.Graphics.FillRegion(blueBrush, fillRegion)
End Sub

설명

Region 사각형과 경로로 구성 됩니다.A Region is composed of rectangles and paths. 지역이 닫혀 있지 않으면 마지막 지점부터 첫 번째 지점까지 추가 세그먼트를 추가 하 여 닫습니다.If the region is not closed, an additional segment is added from the last point to the first point to close it.

적용 대상