다음을 통해 공유


Graphics.IntersectClip 메서드

정의

Graphics 클립 영역을 현재 클립 영역과 지정된 Rectangle 구조체의 교집합으로 업데이트합니다.

오버로드

IntersectClip(Rectangle)

Graphics 클립 영역을 현재 클립 영역과 지정된 Rectangle 구조체의 교집합으로 업데이트합니다.

IntersectClip(RectangleF)

Graphics 클립 영역을 현재 클립 영역과 지정된 RectangleF 구조체의 교집합으로 업데이트합니다.

IntersectClip(Region)

Graphics 클립 영역을 현재 클립 영역과 지정된 Region교집합으로 업데이트합니다.

IntersectClip(Rectangle)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

Graphics 클립 영역을 현재 클립 영역과 지정된 Rectangle 구조체의 교집합으로 업데이트합니다.

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

매개 변수

rect
Rectangle

현재 클립 영역과 교차하는 Rectangle 구조체입니다.

예제

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

  • (0, 0)에서 왼쪽 위 모서리가 있는 사각형을 만들고 클리핑 영역을 이 사각형으로 설정합니다.

  • 왼쪽 위 모서리(100, 100)로 두 번째 사각형을 만들고 클리핑 영역을 이 사각형과 현재 클리핑 영역(첫 번째 사각형)의 교집합으로 설정합니다.

  • 이전 사각형을 모두 포함하는 큰 사각형을 단색 파란색 브러시로 채웁니다.

  • 클리핑 영역을 무한으로 다시 설정합니다.

  • 두 클리핑 영역 주위에 사각형을 그립니다. 첫 번째 클리핑 사각형에는 검은색 펜을 사용하고 두 번째 클리핑 영역에는 빨간색 펜을 사용합니다.

그 결과 두 사각형의 교집합만 파란색으로 채워집니다.

public:
   void IntersectClipRectangle( PaintEventArgs^ e )
   {
      // Set clipping region.
      Rectangle clipRect = Rectangle(0,0,200,200);
      e->Graphics->SetClip( clipRect );

      // Update clipping region to intersection of
      // existing region with specified rectangle.
      Rectangle intersectRect = Rectangle(100,100,200,200);
      e->Graphics->IntersectClip( intersectRect );

      // Fill rectangle to demonstrate effective clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 500, 500 );

      // Reset clipping region to infinite.
      e->Graphics->ResetClip();

      // Draw clipRect and intersectRect to screen.
      e->Graphics->DrawRectangle( gcnew Pen( Color::Black ), clipRect );
      e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), intersectRect );
   }
private void IntersectClipRectangle(PaintEventArgs e)
{

    // Set clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 200, 200);
    e.Graphics.SetClip(clipRect);

    // Update clipping region to intersection of

    // existing region with specified rectangle.
    Rectangle intersectRect = new Rectangle(100, 100, 200, 200);
    e.Graphics.IntersectClip(intersectRect);

    // Fill rectangle to demonstrate effective clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 500, 500);

    // Reset clipping region to infinite.
    e.Graphics.ResetClip();

    // Draw clipRect and intersectRect to screen.
    e.Graphics.DrawRectangle(new Pen(Color.Black), clipRect);
    e.Graphics.DrawRectangle(new Pen(Color.Red), intersectRect);
}
Private Sub IntersectClipRectangle(ByVal e As PaintEventArgs)

    ' Set clipping region.
    Dim clipRect As New Rectangle(0, 0, 200, 200)
    e.Graphics.SetClip(clipRect)

    ' Update clipping region to intersection of

    ' existing region with specified rectangle.
    Dim intersectRect As New Rectangle(100, 100, 200, 200)
    e.Graphics.IntersectClip(intersectRect)

    ' Fill rectangle to demonstrate effective clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Blue), 0, 0, _
    500, 500)

    ' Reset clipping region to infinite.
    e.Graphics.ResetClip()

    ' Draw clipRect and intersectRect to screen.
    e.Graphics.DrawRectangle(New Pen(Color.Black), clipRect)
    e.Graphics.DrawRectangle(New Pen(Color.Red), intersectRect)
End Sub

설명

이 메서드는 현재 클립 영역의 교집합과 rect 매개 변수로 지정된 사각형이 나타내는 영역을 GraphicsClip 속성에 할당합니다.

적용 대상

IntersectClip(RectangleF)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

Graphics 클립 영역을 현재 클립 영역과 지정된 RectangleF 구조체의 교집합으로 업데이트합니다.

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

매개 변수

rect
RectangleF

현재 클립 영역과 교차하는 RectangleF 구조체입니다.

예제

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

  • (0, 0)에서 왼쪽 위 모서리가 있는 사각형을 만들고 클리핑 영역을 이 사각형으로 설정합니다.

  • 왼쪽 위 모서리(100, 100)로 두 번째 사각형을 만들고 클리핑 영역을 이 사각형과 현재 클리핑 영역(첫 번째 사각형)의 교집합으로 설정합니다.

  • 이전 사각형을 모두 포함하는 큰 사각형을 단색 파란색 브러시로 채웁니다.

  • 클리핑 영역을 무한으로 다시 설정합니다.

  • 두 클리핑 영역 주위에 사각형을 그립니다. 첫 번째 클리핑 사각형에는 검은색 펜을 사용하고 두 번째 클리핑 영역에는 빨간색 펜을 사용합니다.

그 결과 두 사각형의 교집합만 파란색으로 채워집니다.

public:
   void IntersectClipRectangleF1( PaintEventArgs^ e )
   {
      // Set clipping region.
      Rectangle clipRect = Rectangle(0,0,200,200);
      e->Graphics->SetClip( clipRect );

      // Update clipping region to intersection of
      // existing region with specified rectangle.
      RectangleF intersectRectF = RectangleF(100.0F,100.0F,200.0F,200.0F);
      e->Graphics->IntersectClip( intersectRectF );

      // Fill rectangle to demonstrate effective clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 500, 500 );

      // Reset clipping region to infinite.
      e->Graphics->ResetClip();

      // Draw clipRect and intersectRect to screen.
      e->Graphics->DrawRectangle( gcnew Pen( Color::Black ), clipRect );
      e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), Rectangle::Round( intersectRectF ) );
   }
private void IntersectClipRectangleF1(PaintEventArgs e)
{

    // Set clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 200, 200);
    e.Graphics.SetClip(clipRect);

    // Update clipping region to intersection of

    // existing region with specified rectangle.
    RectangleF intersectRectF = new RectangleF(100.0F, 100.0F, 200.0F, 200.0F);
    e.Graphics.IntersectClip(intersectRectF);

    // Fill rectangle to demonstrate effective clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 500, 500);

    // Reset clipping region to infinite.
    e.Graphics.ResetClip();

    // Draw clipRect and intersectRect to screen.
    e.Graphics.DrawRectangle(new Pen(Color.Black), clipRect);
    e.Graphics.DrawRectangle(new Pen(Color.Red), Rectangle.Round(intersectRectF));
}
Private Sub IntersectClipRectangleF1(ByVal e As PaintEventArgs)

    ' Set clipping region.
    Dim clipRect As New Rectangle(0, 0, 200, 200)
    e.Graphics.SetClip(clipRect)

    ' Update clipping region to intersection of

    ' existing region with specified rectangle.
    Dim intersectRectF As New RectangleF(100.0F, 100.0F, 200.0F, 200.0F)
    e.Graphics.IntersectClip(intersectRectF)

    ' Fill rectangle to demonstrate effective clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Blue), 0, 0, _
    500, 500)

    ' Reset clipping region to infinite.
    e.Graphics.ResetClip()

    ' Draw clipRect and intersectRect to screen.
    e.Graphics.DrawRectangle(New Pen(Color.Black), clipRect)
    e.Graphics.DrawRectangle(New Pen(Color.Red), _
    Rectangle.Round(intersectRectF))
End Sub

설명

이 메서드는 현재 클립 영역의 교집합과 rect 매개 변수로 지정된 사각형이 나타내는 영역을 GraphicsClip 속성에 할당합니다.

적용 대상

IntersectClip(Region)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs

Graphics 클립 영역을 현재 클립 영역과 지정된 Region교집합으로 업데이트합니다.

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

매개 변수

region
Region

현재 지역과 교차할 Region.

예제

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

  • 왼쪽 위 모서리가 (0, 0)인 사각형을 만듭니다.

  • 영역을 만들고 사각형으로 설정하고 클리핑 영역을 이 지역으로 설정합니다.

  • 왼쪽 위 모서리(100, 100)로 두 번째 사각형을 만듭니다.

  • 영역을 만들고 두 번째 사각형으로 설정하고, Replace결합 모드를 사용하여 이 영역과 현재 클리핑 영역(첫 번째 사각형)의 교집합으로 클리핑 영역을 설정합니다.

  • 두 이전 영역이 모두 포함된 큰 사각형을 단색 파란색 브러시로 채웁니다.

  • 클리핑 영역을 무한으로 다시 설정합니다.

  • 두 클리핑 영역 주위에 사각형을 그립니다. 첫 번째 클리핑 영역에는 검은색 펜을 사용하고 두 번째 클리핑 영역에는 빨간색 펜을 사용합니다.

그 결과 두 영역의 교집합만 파란색으로 채워집니다.

public:
   void IntersectClipRegion( PaintEventArgs^ e )
   {
      // Set clipping region.
      Rectangle clipRect = Rectangle(0,0,200,200);
      System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( clipRect );
      e->Graphics->SetClip( clipRegion, CombineMode::Replace );

      // Update clipping region to intersection of
      // existing region with specified rectangle.
      Rectangle intersectRect = Rectangle(100,100,200,200);
      System::Drawing::Region^ intersectRegion = gcnew System::Drawing::Region( intersectRect );
      e->Graphics->IntersectClip( intersectRegion );

      // Fill rectangle to demonstrate effective clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 500, 500 );

      // Reset clipping region to infinite.
      e->Graphics->ResetClip();

      // Draw clipRect and intersectRect to screen.
      e->Graphics->DrawRectangle( gcnew Pen( Color::Black ), clipRect );
      e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), intersectRect );
   }
private void IntersectClipRegion(PaintEventArgs e)
{

    // Set clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 200, 200);
    Region clipRegion = new Region(clipRect);
    e.Graphics.SetClip(clipRegion, CombineMode.Replace);

    // Update clipping region to intersection of

    // existing region with specified rectangle.
    Rectangle intersectRect = new Rectangle(100, 100, 200, 200);
    Region intersectRegion = new Region(intersectRect);
    e.Graphics.IntersectClip(intersectRegion);

    // Fill rectangle to demonstrate effective clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 500, 500);

    // Reset clipping region to infinite.
    e.Graphics.ResetClip();

    // Draw clipRect and intersectRect to screen.
    e.Graphics.DrawRectangle(new Pen(Color.Black), clipRect);
    e.Graphics.DrawRectangle(new Pen(Color.Red), intersectRect);
}
Private Sub IntersectClipRegion(ByVal e As PaintEventArgs)

    ' Set clipping region.
    Dim clipRect As New Rectangle(0, 0, 200, 200)
    Dim clipRegion As New [Region](clipRect)
    e.Graphics.SetClip(clipRegion, CombineMode.Replace)

    ' Update clipping region to intersection of

    ' existing region with specified rectangle.
    Dim intersectRect As New Rectangle(100, 100, 200, 200)
    Dim intersectRegion As New [Region](intersectRect)
    e.Graphics.IntersectClip(intersectRegion)

    ' Fill rectangle to demonstrate effective clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Blue), 0, 0, _
    500, 500)

    ' Reset clipping region to infinite.
    e.Graphics.ResetClip()

    ' Draw clipRect and intersectRect to screen.
    e.Graphics.DrawRectangle(New Pen(Color.Black), clipRect)
    e.Graphics.DrawRectangle(New Pen(Color.Red), intersectRect)
End Sub

설명

이 메서드는 현재 클립 영역의 교집합과 region 매개 변수로 지정된 영역이 나타내는 영역을 GraphicsClip 속성에 할당합니다.

적용 대상