Region.Exclude 메서드

정의

지정된 Region 구조체와 교차하지 않는 내부 부분으로 업데이트 Rectangle 합니다.

오버로드

Name Description
Exclude(Region)

지정된 부분과 교차하지 않는 내부 부분만 포함하도록 업데이트 Region 합니다 Region.

Exclude(GraphicsPath)

지정된 부분과 교차하지 않는 내부 부분만 포함하도록 업데이트 Region 합니다 GraphicsPath.

Exclude(Rectangle)

지정된 Region 구조와 교차하지 않는 내부 부분만 포함하도록 업데이트 Rectangle 합니다.

Exclude(RectangleF)

지정된 Region 구조와 교차하지 않는 내부 부분만 포함하도록 업데이트 RectangleF 합니다.

Exclude(Region)

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

지정된 부분과 교차하지 않는 내부 부분만 포함하도록 업데이트 Region 합니다 Region.

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

매개 변수

region
Region

Region 값에서 제외할 값입니다 Region.

예외

regionnull입니다.

예제

코드 예제는 및 Exclude(RectangleF) 메서드를 Complement(Region) 참조하세요.

적용 대상

Exclude(GraphicsPath)

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

지정된 부분과 교차하지 않는 내부 부분만 포함하도록 업데이트 Region 합니다 GraphicsPath.

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

매개 변수

path
GraphicsPath

GraphicsPath 값에서 제외할 값입니다 Region.

예외

pathnull입니다.

예제

다음 코드 예제에서는 생성자 및 메서드를 RegionExclude 보여 Dispose 줍니다.

이 예제는 Windows Forms와 함께 사용하도록 설계되었습니다. 폼에 코드를 붙여넣고 양식의 FillRegionExcludingPath 이벤트를 처리할 때 메서드를 호출 Paint 하여 다음과 같이 e전달 PaintEventArgs 합니다.

private:
   void FillRegionExcludingPath( PaintEventArgs^ e )
   {
      // Create the region using a rectangle.
      System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( Rectangle(20,20,100,100) );

      // Create the GraphicsPath.
      System::Drawing::Drawing2D::GraphicsPath^ path = gcnew System::Drawing::Drawing2D::GraphicsPath;

      // Add a circle to the graphics path.
      path->AddEllipse( 50, 50, 25, 25 );

      // Exclude the circle from the region.
      myRegion->Exclude( path );

      // Retrieve a Graphics object from the form.
      Graphics^ formGraphics = e->Graphics;

      // Fill the region in blue.
      formGraphics->FillRegion( Brushes::Blue, myRegion );

      // Dispose of the path and region objects.
      delete path;
      delete myRegion;
   }
private void FillRegionExcludingPath(PaintEventArgs e)
{

    // Create the region using a rectangle.
    Region myRegion = new Region(new Rectangle(20, 20, 100, 100));

    // Create the GraphicsPath.
    System.Drawing.Drawing2D.GraphicsPath path = 
        new System.Drawing.Drawing2D.GraphicsPath();

    // Add a circle to the graphics path.
    path.AddEllipse(50, 50, 25, 25);

    // Exclude the circle from the region.
    myRegion.Exclude(path);

    // Retrieve a Graphics object from the form.
    Graphics formGraphics = e.Graphics;

    // Fill the region in blue.
    formGraphics.FillRegion(Brushes.Blue, myRegion);

    // Dispose of the path and region objects.
    path.Dispose();
    myRegion.Dispose();
}
Private Sub FillRegionExcludingPath(ByVal e As PaintEventArgs)

    ' Create the region using a rectangle.
    Dim myRegion As New Region(New Rectangle(20, 20, 100, 100))

    ' Create the GraphicsPath.
    Dim path As New System.Drawing.Drawing2D.GraphicsPath

    ' Add a circle to the graphics path.
    path.AddEllipse(50, 50, 25, 25)

    ' Exclude the circle from the region.
    myRegion.Exclude(path)

    ' Retrieve a Graphics object from the form.
    Dim formGraphics As Graphics = e.Graphics

    ' Fill the region in blue.
    formGraphics.FillRegion(Brushes.Blue, myRegion)

    ' Dispose of the path and region objects.
    path.Dispose()
    myRegion.Dispose()

End Sub

적용 대상

Exclude(Rectangle)

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

지정된 Region 구조와 교차하지 않는 내부 부분만 포함하도록 업데이트 Rectangle 합니다.

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

매개 변수

rect
Rectangle

Rectangle 구조체에서 제외할 구조체 Region입니다.

예제

코드 예제는 메서드를 참조하세요 Exclude(RectangleF) .

적용 대상

Exclude(RectangleF)

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

지정된 Region 구조와 교차하지 않는 내부 부분만 포함하도록 업데이트 RectangleF 합니다.

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

매개 변수

rect
RectangleF

RectangleF 구조체에서 제외할 구조체 Region입니다.

예제

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

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

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

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

  • 두 번째 사각형과 결합될 때 영역의 비클러스터형 영역을 가져옵니다.

  • 비클러스터형 영역을 파란색으로 채우고 화면에 그립니다.

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

public:
   void Exclude_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 nonexcluded area of myRegion when combined with
      // complementRect.
      myRegion->Exclude( complementRect );
      
      // Fill the nonexcluded area of myRegion with blue.
      SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue );
      e->Graphics->FillRegion( myBrush, myRegion );
   }
public void Exclude_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 nonexcluded area of myRegion when combined with
             
    // complementRect.
    myRegion.Exclude(complementRect);
             
    // Fill the nonexcluded area of myRegion with blue.
    SolidBrush myBrush = new SolidBrush(Color.Blue);
    e.Graphics.FillRegion(myBrush, myRegion);
}
Public Sub Exclude_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 nonexcluded area of myRegion when combined with
    ' complementRect.
    myRegion.Exclude(complementRect)

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

적용 대상