다음을 통해 공유


Region.MakeInfinite 메서드

정의

Region 개체를 제한이 없는 내부로 초기화합니다.

public:
 void MakeInfinite();
public void MakeInfinite ();
member this.MakeInfinite : unit -> unit
Public Sub MakeInfinite ()

예제

다음 코드 예제에서는 MakeInfinite 메서드를 사용하는 방법을 보여 줍니다. 이 예제는 Windows Forms 함께 사용하도록 설계되었습니다. 양식을 Create 다음 코드를 붙여넣습니다. FillEmptyRegion 형식의 Paint 이벤트 처리 메서드에서 메서드를 호출하고 를 로 PaintEventArgs전달 e 합니다.

private:
   void FillInfiniteRegion( PaintEventArgs^ e )
   {
      // Create a region from a rectangle.
      Rectangle originalRectangle = Rectangle(40,40,40,50);
      System::Drawing::Region^ smallRegion = gcnew System::Drawing::Region( originalRectangle );

      // Call MakeInfinite.
      smallRegion->MakeInfinite();

      // Fill the region in red and draw the original rectangle
      // in black. Note that the entire form is filled in.
      e->Graphics->FillRegion( Brushes::Red, smallRegion );
      e->Graphics->DrawRectangle( Pens::Black, originalRectangle );
   }
private void FillInfiniteRegion(PaintEventArgs e)
{
    // Create a region from a rectangle.
    Rectangle originalRectangle = new Rectangle(40, 40, 40, 50);
    Region smallRegion = new Region(originalRectangle);

    // Call MakeInfinite.
    smallRegion.MakeInfinite();

    // Fill the region in red and draw the original rectangle
    // in black. Note that the entire form is filled in.
    e.Graphics.FillRegion(Brushes.Red, smallRegion);
    e.Graphics.DrawRectangle(Pens.Black, originalRectangle);
}
Private Sub FillInfiniteRegion(ByVal e As PaintEventArgs)
    ' Create a region from a rectangle.
    Dim originalRectangle As New Rectangle(40, 40, 40, 50)
    Dim smallRegion As New Region(originalRectangle)

    ' Call MakeInfinite.
    smallRegion.MakeInfinite()

    ' Fill the region in red and draw the original rectangle
    ' in black. Note that the entire form is filled in.
    e.Graphics.FillRegion(Brushes.Red, smallRegion)
    e.Graphics.DrawRectangle(Pens.Black, originalRectangle)

End Sub

적용 대상