Region.Complement 메서드

정의

Region과 교차하지 않는 지정된 RectangleF 구조체의 일부로 이 Region을 업데이트합니다.

오버로드

Complement(Region)

Region과 교차하지 않는 지정된 Region의 일부를 포함하도록 이 Region을 업데이트합니다.

Complement(RectangleF)

Region과 교차하지 않는 지정된 RectangleF 구조체의 일부가 들어 있는 이 Region을 업데이트합니다.

Complement(GraphicsPath)

Region과 교차하지 않는 지정된 GraphicsPath의 일부를 포함하도록 이 Region을 업데이트합니다.

Complement(Rectangle)

Region과 교차하지 않는 지정된 Rectangle 구조체의 일부가 들어 있는 이 Region을 업데이트합니다.

Complement(Region)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

Region과 교차하지 않는 지정된 Region의 일부를 포함하도록 이 Region을 업데이트합니다.

public:
 void Complement(System::Drawing::Region ^ region);
public void Complement (System.Drawing.Region region);
member this.Complement : System.Drawing.Region -> unit
Public Sub Complement (region As Region)

매개 변수

region
Region

Region 개체를 보완할 Region 개체입니다.

예외

region이(가) null인 경우

예제

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

  • 사각형을 만들어 화면에 검은색으로 그립니다.

  • 첫 번째 사각형과 교차하는 두 번째 사각형을 만들고 빨간색으로 화면에 그립니다.

  • 첫 번째 사각형을 사용하여 하나의 영역을 만들고 두 번째 사각형을 사용하여 두 번째 영역을 만듭니다.

  • 두 번째 영역과 결합된 경우 첫 번째 영역의 보수를 가져옵니다.

  • 보수 영역을 파란색으로 채우고 화면에 그립니다.

첫 번째 영역과 교차하지 않는 두 번째 영역의 영역은 파란색입니다.

public:
   void Complement_Region_Example( PaintEventArgs^ e )
   {
      // Create the first rectangle and draw it to the screen in black.
      Rectangle regionRect = Rectangle(20,20,100,100);
      e->Graphics->DrawRectangle( Pens::Black, regionRect );

      // Create the second rectangle and draw it to the screen in red.
      Rectangle complementRect = Rectangle(90,30,100,100);
      e->Graphics->DrawRectangle( Pens::Red, complementRect );

      // Create a region from the first rectangle.
      System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect );

      // Create a complement region.
      System::Drawing::Region^ complementRegion = gcnew System::Drawing::Region( complementRect );

      // Get the complement of myRegion when combined with
      // complementRegion.
      myRegion->Complement( complementRegion );

      // Fill the complement area with blue.
      SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue );
      e->Graphics->FillRegion( myBrush, myRegion );
   }
public void Complement_Region_Example(PaintEventArgs e)
{
             
    // Create the first rectangle and draw it to the screen in black.
    Rectangle regionRect = new Rectangle(20, 20, 100, 100);
    e.Graphics.DrawRectangle(Pens.Black, regionRect);
             
    // Create the second rectangle and draw it to the screen in red.
    Rectangle complementRect = new Rectangle(90, 30, 100, 100);
    e.Graphics.DrawRectangle(Pens.Red, complementRect);
             
    // Create a region from the first rectangle.
    Region myRegion = new Region(regionRect);
             
    // Create a complement region.
    Region complementRegion = new Region(complementRect);
             
    // Get the complement of myRegion when combined with
             
    // complementRegion.
    myRegion.Complement(complementRegion);
             
    // Fill the complement area with blue.
    SolidBrush myBrush = new SolidBrush(Color.Blue);
    e.Graphics.FillRegion(myBrush, myRegion);
}
Public Sub Complement_Region_Example(ByVal e As PaintEventArgs)

    ' Create the first rectangle and draw it to the screen in black.
    Dim regionRect As New Rectangle(20, 20, 100, 100)
    e.Graphics.DrawRectangle(Pens.Black, regionRect)

    ' Create the second rectangle and draw it to the screen in red.
    Dim complementRect As New Rectangle(90, 30, 100, 100)
    e.Graphics.DrawRectangle(Pens.Red, complementRect)

    ' create a region from the first rectangle.
    Dim myRegion As New [Region](regionRect)

    ' Create a complement region.
    Dim complementRegion As New [Region](complementRect)

    ' Get the complement of myRegion when combined with
    ' complementRegion.
    myRegion.Complement(complementRegion)

    ' Fill the complement area with blue.
    Dim myBrush As New SolidBrush(Color.Blue)
    e.Graphics.FillRegion(myBrush, myRegion)
End Sub

적용 대상

Complement(RectangleF)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

Region과 교차하지 않는 지정된 RectangleF 구조체의 일부가 들어 있는 이 Region을 업데이트합니다.

public:
 void Complement(System::Drawing::RectangleF rect);
public void Complement (System.Drawing.RectangleF rect);
member this.Complement : System.Drawing.RectangleF -> unit
Public Sub Complement (rect As RectangleF)

매개 변수

rect
RectangleF

RectangleF을 보충하는 Region 구조체입니다.

예제

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

  • 사각형을 만들고 검은색으로 화면에 그립니다.

  • 첫 번째 사각형과 교차하는 두 번째 사각형을 만들고 빨간색으로 화면에 그립니다.

  • 첫 번째 사각형을 사용하여 영역을 만듭니다.

  • 두 번째 사각형과 결합된 해당 영역의 보수를 가져옵니다.

  • 보수 영역을 파란색으로 채우고 화면에 그립니다.

영역과 교차하지 않는 두 번째 사각형의 영역은 파란색으로 표시됩니다.

public:
   void Complement_RectF_Example( PaintEventArgs^ e )
   {
      // Create the first rectangle and draw it to the screen in black.
      Rectangle regionRect = Rectangle(20,20,100,100);
      e->Graphics->DrawRectangle( Pens::Black, regionRect );

      // Create the second rectangle and draw it to the screen in red.
      RectangleF complementRect = RectangleF(90,30,100,100);
      e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( complementRect ) );

      // Create a region using the first rectangle.
      System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect );

      // Get the complement of the region combined with the second
      // rectangle.
      myRegion->Complement( complementRect );

      // Fill the complement area with blue.
      SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue );
      e->Graphics->FillRegion( myBrush, myRegion );
   }
public void Complement_RectF_Example(PaintEventArgs e)
{
             
    // Create the first rectangle and draw it to the screen in black.
    Rectangle regionRect = new Rectangle(20, 20, 100, 100);
    e.Graphics.DrawRectangle(Pens.Black, regionRect);
             
    // Create the second rectangle and draw it to the screen in red.
    RectangleF complementRect = new RectangleF(90, 30, 100, 100);
    e.Graphics.DrawRectangle(Pens.Red,
        Rectangle.Round(complementRect));
             
    // Create a region using the first rectangle.
    Region myRegion = new Region(regionRect);
             
    // Get the complement of the region combined with the second
             
    // rectangle.
    myRegion.Complement(complementRect);
             
    // Fill the complement area with blue.
    SolidBrush myBrush = new SolidBrush(Color.Blue);
    e.Graphics.FillRegion(myBrush, myRegion);
}
Public Sub Complement_RectF_Example(ByVal e As PaintEventArgs)

    ' Create the first rectangle and draw it to the screen in black.
    Dim regionRect As New Rectangle(20, 20, 100, 100)
    e.Graphics.DrawRectangle(Pens.Black, regionRect)

    ' Create the second rectangle and draw it to the screen in red.
    Dim complementRect As New RectangleF(90, 30, 100, 100)
    e.Graphics.DrawRectangle(Pens.Red, _
    Rectangle.Round(complementRect))

    ' Create a region using the first rectangle.
    Dim myRegion As New [Region](regionRect)

    ' Get the complement of the region combined with the second
    ' rectangle.
    myRegion.Complement(complementRect)

    ' Fill the complement area with blue.
    Dim myBrush As New SolidBrush(Color.Blue)
    e.Graphics.FillRegion(myBrush, myRegion)
End Sub

적용 대상

Complement(GraphicsPath)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

Region과 교차하지 않는 지정된 GraphicsPath의 일부를 포함하도록 이 Region을 업데이트합니다.

public:
 void Complement(System::Drawing::Drawing2D::GraphicsPath ^ path);
public void Complement (System.Drawing.Drawing2D.GraphicsPath path);
member this.Complement : System.Drawing.Drawing2D.GraphicsPath -> unit
Public Sub Complement (path As GraphicsPath)

매개 변수

path
GraphicsPath

Region을 보완할 GraphicsPath입니다.

예외

path이(가) null인 경우

예제

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

  • 사각형을 만들고 검은색으로 화면에 그립니다.

  • 첫 번째 사각형과 교차하는 두 번째 사각형을 만들고 빨간색으로 화면에 그립니다.

  • 첫 번째 사각형을 사용하여 영역을 만듭니다.

  • GraphicsPath만들고 두 번째 사각형을 추가합니다.

  • 와 결합된 경우 영역의 보수를 GraphicsPath가져옵니다.

  • 보수 영역을 파란색으로 채우고 화면에 그립니다.

영역과 교차하지 않는 의 GraphicsPath 영역은 파란색입니다.

public:
   void Complement_Path_Example( PaintEventArgs^ e )
   {
      // Create the first rectangle and draw it to the screen in black.
      Rectangle regionRect = Rectangle(20,20,100,100);
      e->Graphics->DrawRectangle( Pens::Black, regionRect );

      // Create the second rectangle and draw it to the screen in red.
      Rectangle complementRect = Rectangle(90,30,100,100);
      e->Graphics->DrawRectangle( Pens::Red, complementRect );

      // Create a graphics path and add the second rectangle to it.
      GraphicsPath^ complementPath = gcnew GraphicsPath;
      complementPath->AddRectangle( complementRect );

      // Create a region using the first rectangle.
      System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect );

      // Get the complement of myRegion when combined with
      // complementPath.
      myRegion->Complement( complementPath );

      // Fill the complement area with blue.
      SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue );
      e->Graphics->FillRegion( myBrush, myRegion );
   }
public void Complement_Path_Example(PaintEventArgs e)
{
             
    // Create the first rectangle and draw it to the screen in black.
    Rectangle regionRect = new Rectangle(20, 20, 100, 100);
    e.Graphics.DrawRectangle(Pens.Black, regionRect);
             
    // Create the second rectangle and draw it to the screen in red.
    Rectangle complementRect = new Rectangle(90, 30, 100, 100);
    e.Graphics.DrawRectangle(Pens.Red, complementRect);
             
    // Create a graphics path and add the second rectangle to it.
    GraphicsPath complementPath = new GraphicsPath();
    complementPath.AddRectangle(complementRect);
             
    // Create a region using the first rectangle.
    Region myRegion = new Region(regionRect);
             
    // Get the complement of myRegion when combined with
             
    // complementPath.
    myRegion.Complement(complementPath);
             
    // Fill the complement area with blue.
    SolidBrush myBrush = new SolidBrush(Color.Blue);
    e.Graphics.FillRegion(myBrush, myRegion);
}
Public Sub Complement_Path_Example(ByVal e As PaintEventArgs)

    ' Create the first rectangle and draw it to the screen in black.
    Dim regionRect As New Rectangle(20, 20, 100, 100)
    e.Graphics.DrawRectangle(Pens.Black, regionRect)

    ' Create the second rectangle and draw it to the screen in red.
    Dim complementRect As New Rectangle(90, 30, 100, 100)
    e.Graphics.DrawRectangle(Pens.Red, complementRect)

    ' Create a graphics path and add the second rectangle to it.
    Dim complementPath As New GraphicsPath
    complementPath.AddRectangle(complementRect)

    ' Create a region using the first rectangle.
    Dim myRegion As New [Region](regionRect)

    ' Get the complement of myRegion when combined with
    ' complementPath.
    myRegion.Complement(complementPath)

    ' Fill the complement area with blue.
    Dim myBrush As New SolidBrush(Color.Blue)
    e.Graphics.FillRegion(myBrush, myRegion)
End Sub

적용 대상

Complement(Rectangle)

Source:
Region.cs
Source:
Region.cs
Source:
Region.cs

Region과 교차하지 않는 지정된 Rectangle 구조체의 일부가 들어 있는 이 Region을 업데이트합니다.

public:
 void Complement(System::Drawing::Rectangle rect);
public void Complement (System.Drawing.Rectangle rect);
member this.Complement : System.Drawing.Rectangle -> unit
Public Sub Complement (rect As Rectangle)

매개 변수

rect
Rectangle

Rectangle을 보충하는 Region 구조체입니다.

예제

예를 들어 참조 된 Complement(RectangleF) 메서드.

적용 대상