Region.Exclude 메서드

정의

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

오버로드

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

지정된 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입니다.

예외

region이(가) null인 경우

예제

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

적용 대상

Exclude(GraphicsPath)

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입니다.

예외

path이(가) null인 경우

예제

다음 코드 예제에서는 Region 생성자 및 ExcludeDispose 메서드입니다.

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

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

지정된 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

지정된 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 사용하도록 설계되었으며 이벤트 처리기의 매개 변수 Paint 인 가 필요합니다.PaintEventArgse 코드는 다음 작업을 수행합니다.

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

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

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

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

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

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

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

적용 대상