Graphics.FillRegion(Brush, Region) Graphics.FillRegion(Brush, Region) Graphics.FillRegion(Brush, Region) Method

정의

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

매개 변수

brush
Brush Brush Brush

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

region
Region Region Region

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

예외

brushnull입니다.brush is null.

또는-or- regionnull입니다.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.

적용 대상