Graphics.SetClip 메서드

정의

Graphics의 클립 영역을 지정된 GraphicsClip 속성으로 설정합니다.

오버로드

SetClip(Region, CombineMode)

현재 클립 영역과 지정된 Graphics를 결합하는 지정된 작업의 결과로 이 Region의 클립 영역을 설정합니다.

SetClip(RectangleF, CombineMode)

현재 클립 영역과 Graphics 구조체에 의해 지정된 사각형을 결합하는 지정된 작업의 결과로 이 RectangleF의 클립 영역을 설정합니다.

SetClip(Rectangle, CombineMode)

현재 클립 영역과 Graphics 구조체에 의해 지정된 사각형을 결합하는 지정된 작업의 결과로 이 Rectangle의 클립 영역을 설정합니다.

SetClip(Graphics, CombineMode)

현재 클립 영역과 지정된 GraphicsClip 속성의 지정된 결합 작업의 결과로 이 Graphics의 클립 영역을 설정합니다.

SetClip(RectangleF)

Graphics의 클립 영역을 RectangleF 구조체에 의해 지정된 사각형으로 설정합니다.

SetClip(Rectangle)

Graphics의 클립 영역을 Rectangle 구조체에 의해 지정된 사각형으로 설정합니다.

SetClip(Graphics)

Graphics의 클립 영역을 지정된 GraphicsClip 속성으로 설정합니다.

SetClip(GraphicsPath)

Graphics의 클립 영역을 지정된 GraphicsPath로 설정합니다.

SetClip(GraphicsPath, CombineMode)

현재 클립 영역과 지정된 Graphics를 결합하는 지정된 작업의 결과로 이 GraphicsPath의 클립 영역을 설정합니다.

SetClip(Region, CombineMode)

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

현재 클립 영역과 지정된 Graphics를 결합하는 지정된 작업의 결과로 이 Region의 클립 영역을 설정합니다.

public:
 void SetClip(System::Drawing::Region ^ region, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Region region, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Region * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (region As Region, combineMode As CombineMode)

매개 변수

region
Region

결합할 Region입니다.

combineMode
CombineMode

사용할 결합 작업을 지정하는 CombineMode 열거형의 멤버입니다.

예제

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

  • 클리핑 영역에 대한 작은 사각형을 만듭니다.

  • 멤버를 사용하여 클리핑 영역을 사각형으로 Replace 설정합니다.

  • 큰 사각형을 단색 검은색 브러시로 채웁니다.

그 결과 작고 채워진 검은색 사각형이 생성됩니다.

public:
   void SetClipRegionCombine( PaintEventArgs^ e )
   {
      // Create region for clipping.
      System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(0,0,100,100) );

      // Set clipping region of graphics to region.
      e->Graphics->SetClip( clipRegion, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRegionCombine(PaintEventArgs e)
{

    // Create region for clipping.
    Region clipRegion = new Region(new Rectangle(0, 0, 100, 100));

    // Set clipping region of graphics to region.
    e.Graphics.SetClip(clipRegion, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRegionCombine(ByVal e As PaintEventArgs)

    ' Create region for clipping.
    Dim clipRegion As New [Region](New Rectangle(0, 0, 100, 100))

    ' Set clipping region of graphics to region.
    e.Graphics.SetClip(clipRegion, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

적용 대상

SetClip(RectangleF, CombineMode)

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

현재 클립 영역과 Graphics 구조체에 의해 지정된 사각형을 결합하는 지정된 작업의 결과로 이 RectangleF의 클립 영역을 설정합니다.

public:
 void SetClip(System::Drawing::RectangleF rect, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.RectangleF rect, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.RectangleF * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (rect As RectangleF, combineMode As CombineMode)

매개 변수

rect
RectangleF

결합할 RectangleF 구조체입니다.

combineMode
CombineMode

사용할 결합 작업을 지정하는 CombineMode 열거형의 멤버입니다.

예제

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

  • 클리핑 영역에 대한 작은 사각형을 만듭니다.

  • 멤버를 사용하여 클리핑 영역을 사각형으로 Replace 설정합니다.

  • 큰 사각형을 단색 검은색 브러시로 채웁니다.

그 결과 작고 채워진 검은색 사각형이 생성됩니다.

public:
   void SetClipRectangleFCombine( PaintEventArgs^ e )
   {
      // Create rectangle for clipping region.
      RectangleF clipRect = RectangleF(0.0F,0.0F,100.0F,100.0F);

      // Set clipping region of graphics to rectangle.
      e->Graphics->SetClip( clipRect, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangleFCombine(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    RectangleF clipRect = new RectangleF(0.0F, 0.0F, 100.0F, 100.0F);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangleFCombine(ByVal e As PaintEventArgs)

    ' Create rectangle for clipping region.
    Dim clipRect As New RectangleF(0.0F, 0.0F, 100.0F, 100.0F)

    ' Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

적용 대상

SetClip(Rectangle, CombineMode)

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

현재 클립 영역과 Graphics 구조체에 의해 지정된 사각형을 결합하는 지정된 작업의 결과로 이 Rectangle의 클립 영역을 설정합니다.

public:
 void SetClip(System::Drawing::Rectangle rect, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Rectangle rect, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Rectangle * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (rect As Rectangle, combineMode As CombineMode)

매개 변수

rect
Rectangle

결합할 Rectangle 구조체입니다.

combineMode
CombineMode

사용할 결합 작업을 지정하는 CombineMode 열거형의 멤버입니다.

예제

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

  • 클리핑 영역에 대한 작은 사각형을 만듭니다.

  • 멤버를 사용하여 클리핑 영역을 사각형으로 Replace 설정합니다.

  • 큰 사각형을 단색 검은색 브러시로 채웁니다.

그 결과 작고 채워진 검은색 사각형이 생성됩니다.

public:
   void SetClipRectangleCombine( PaintEventArgs^ e )
   {
      // Create rectangle for clipping region.
      Rectangle clipRect = Rectangle(0,0,100,100);

      // Set clipping region of graphics to rectangle.
      e->Graphics->SetClip( clipRect, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangleCombine(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 100, 100);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangleCombine(ByVal e As PaintEventArgs)

    ' Create rectangle for clipping region.
    Dim clipRect As New Rectangle(0, 0, 100, 100)

    ' Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

적용 대상

SetClip(Graphics, CombineMode)

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

현재 클립 영역과 지정된 GraphicsClip 속성의 지정된 결합 작업의 결과로 이 Graphics의 클립 영역을 설정합니다.

public:
 void SetClip(System::Drawing::Graphics ^ g, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Graphics g, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Graphics * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (g As Graphics, combineMode As CombineMode)

매개 변수

g
Graphics

결합할 클립 영역을 지정하는 Graphics입니다.

combineMode
CombineMode

사용할 결합 작업을 지정하는 CombineMode 열거형의 멤버입니다.

예제

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

  • 예제의 에서 thisFormForm 임시 Graphics 를 만듭니다.

  • 임시 Graphics 의 클리핑 영역을 작은 사각형으로 설정합니다.

  • 폼 그래픽 개체의 클리핑 영역을 멤버를 사용하여 새 Graphics 의 클리핑 영역으로 Replace 업데이트.

  • 큰 사각형을 단색 검은색 브러시로 채웁니다.

그 결과 작고 채워진 검은색 사각형이 생성됩니다.

public:
   void SetClipGraphicsCombine( PaintEventArgs^ e )
   {
      // Create temporary graphics object and set its clipping region.
      Graphics^ newGraphics = this->CreateGraphics();
      newGraphics->SetClip( Rectangle(0,0,100,100) );

      // Update clipping region of graphics to clipping region of new
      // graphics.
      e->Graphics->SetClip( newGraphics, CombineMode::Replace );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );

      // Release new graphics.
      delete newGraphics;
   }
private void SetClipGraphicsCombine(PaintEventArgs e)
{

    // Create temporary graphics object and set its clipping region.
    Graphics newGraphics = this.CreateGraphics();
    newGraphics.SetClip(new Rectangle(0, 0, 100, 100));

    // Update clipping region of graphics to clipping region of new

    // graphics.
    e.Graphics.SetClip(newGraphics, CombineMode.Replace);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);

    // Release new graphics.
    newGraphics.Dispose();
}
Private Sub SetClipGraphicsCombine(ByVal e As PaintEventArgs)

    ' Create temporary graphics object and set its clipping region.
    Dim newGraphics As Graphics = Me.CreateGraphics()
    newGraphics.SetClip(New Rectangle(0, 0, 100, 100))

    ' Update clipping region of graphics to clipping region of new

    ' graphics.
    e.Graphics.SetClip(newGraphics, CombineMode.Replace)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)

    ' Release new graphics.
    newGraphics.Dispose()
End Sub

적용 대상

SetClip(RectangleF)

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

Graphics의 클립 영역을 RectangleF 구조체에 의해 지정된 사각형으로 설정합니다.

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

매개 변수

rect
RectangleF

새 클립 영역을 나타내는 RectangleF 구조체입니다.

예제

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

  • 클리핑 영역에 대한 작은 사각형을 만듭니다.

  • 클리핑 영역을 사각형으로 설정합니다.

  • 큰 사각형을 단색 검은색 브러시로 채웁니다.

그 결과 작고 채워진 검은색 사각형이 생성됩니다.

public:
   void SetClipRectangleF( PaintEventArgs^ e )
   {
      // Create rectangle for clipping region.
      RectangleF clipRect = RectangleF(0.0F,0.0F,100.0F,100.0F);

      // Set clipping region of graphics to rectangle.
      e->Graphics->SetClip( clipRect );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangleF(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    RectangleF clipRect = new RectangleF(0.0F, 0.0F, 100.0F, 100.0F);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangleF(ByVal e As PaintEventArgs)

    ' Create rectangle for clipping region.
    Dim clipRect As New RectangleF(0.0F, 0.0F, 100.0F, 100.0F)

    ' Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

적용 대상

SetClip(Rectangle)

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

Graphics의 클립 영역을 Rectangle 구조체에 의해 지정된 사각형으로 설정합니다.

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

매개 변수

rect
Rectangle

새 클립 영역을 나타내는 Rectangle 구조체입니다.

예제

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

  • 클리핑 영역에 대한 작은 사각형을 만듭니다.

  • 클리핑 영역을 사각형으로 설정합니다.

  • 큰 사각형을 단색 검은색 브러시로 채웁니다.

그 결과 작고 채워진 검은색 사각형이 생성됩니다.

public:
   void SetClipRectangle( PaintEventArgs^ e )
   {
      // Create rectangle for clipping region.
      Rectangle clipRect = Rectangle(0,0,100,100);

      // Set clipping region of graphics to rectangle.
      e->Graphics->SetClip( clipRect );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipRectangle(PaintEventArgs e)
{

    // Create rectangle for clipping region.
    Rectangle clipRect = new Rectangle(0, 0, 100, 100);

    // Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipRectangle(ByVal e As PaintEventArgs)

    ' Create rectangle for clipping region.
    Dim clipRect As New Rectangle(0, 0, 100, 100)

    ' Set clipping region of graphics to rectangle.
    e.Graphics.SetClip(clipRect)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

적용 대상

SetClip(Graphics)

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

Graphics의 클립 영역을 지정된 GraphicsClip 속성으로 설정합니다.

public:
 void SetClip(System::Drawing::Graphics ^ g);
public void SetClip (System.Drawing.Graphics g);
member this.SetClip : System.Drawing.Graphics -> unit
Public Sub SetClip (g As Graphics)

매개 변수

g
Graphics

새 클립 영역을 가져오는 Graphics입니다.

예제

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

  • 예제의 에서 thisFormForm 임시 Graphics 를 만듭니다.

  • 임시 Graphics 의 클리핑 영역을 작은 사각형으로 설정합니다.

  • 폼 그래픽 개체의 클리핑 영역을 임시 Graphics의 클리핑 영역으로 업데이트.

  • 큰 사각형을 단색 검은색 브러시로 채웁니다.

그 결과 작고 채워진 검은색 사각형이 생성됩니다.

public:
   void SetClipGraphics( PaintEventArgs^ e )
   {
      // Create temporary graphics object and set its clipping region.
      Graphics^ newGraphics = this->CreateGraphics();
      newGraphics->SetClip( Rectangle(0,0,100,100) );

      // Update clipping region of graphics to clipping region of new
      // graphics.
      e->Graphics->SetClip( newGraphics );

      // Fill rectangle to demonstrate clip region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );

      // Release new graphics.
      delete newGraphics;
   }
private void SetClipGraphics(PaintEventArgs e)
{

    // Create temporary graphics object and set its clipping region.
    Graphics newGraphics = this.CreateGraphics();
    newGraphics.SetClip(new Rectangle(0, 0, 100, 100));

    // Update clipping region of graphics to clipping region of new

    // graphics.
    e.Graphics.SetClip(newGraphics);

    // Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);

    // Release new graphics.
    newGraphics.Dispose();
}
Private Sub SetClipGraphics(ByVal e As PaintEventArgs)

    ' Create temporary graphics object and set its clipping region.
    Dim newGraphics As Graphics = Me.CreateGraphics()
    newGraphics.SetClip(New Rectangle(0, 0, 100, 100))

    ' Update clipping region of graphics to clipping region of new

    ' graphics.
    e.Graphics.SetClip(newGraphics)

    ' Fill rectangle to demonstrate clip region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)

    ' Release new graphics.
    newGraphics.Dispose()
End Sub

적용 대상

SetClip(GraphicsPath)

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

Graphics의 클립 영역을 지정된 GraphicsPath로 설정합니다.

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

매개 변수

path
GraphicsPath

새 클립 영역을 나타내는 GraphicsPath입니다.

예제

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

  • 그래픽 경로를 만들고 경로에 타원을 추가합니다.

  • 클리핑 영역을 타원형 경로로 설정합니다.

  • 큰 사각형을 단색 검은색 브러시로 채웁니다.

결과는 채워진 검은색 타원입니다.

public:
   void SetClipPath( PaintEventArgs^ e )
   {
      // Create graphics path.
      GraphicsPath^ clipPath = gcnew GraphicsPath;
      clipPath->AddEllipse( 0, 0, 200, 100 );

      // Set clipping region to path.
      e->Graphics->SetClip( clipPath );

      // Fill rectangle to demonstrate clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipPath(PaintEventArgs e)
{

    // Create graphics path.
    GraphicsPath clipPath = new GraphicsPath();
    clipPath.AddEllipse(0, 0, 200, 100);

    // Set clipping region to path.
    e.Graphics.SetClip(clipPath);

    // Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipPath(ByVal e As PaintEventArgs)

    ' Create graphics path.
    Dim clipPath As New GraphicsPath
    clipPath.AddEllipse(0, 0, 200, 100)

    ' Set clipping region to path.
    e.Graphics.SetClip(clipPath)

    ' Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

설명

매개 변수가 나타내는 path 그래픽 경로가 닫혀 있지 않으면 마지막 지점에서 첫 번째 지점까지 추가 세그먼트가 추가되어 경로를 닫습니다.

적용 대상

SetClip(GraphicsPath, CombineMode)

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

현재 클립 영역과 지정된 Graphics를 결합하는 지정된 작업의 결과로 이 GraphicsPath의 클립 영역을 설정합니다.

public:
 void SetClip(System::Drawing::Drawing2D::GraphicsPath ^ path, System::Drawing::Drawing2D::CombineMode combineMode);
public void SetClip (System.Drawing.Drawing2D.GraphicsPath path, System.Drawing.Drawing2D.CombineMode combineMode);
member this.SetClip : System.Drawing.Drawing2D.GraphicsPath * System.Drawing.Drawing2D.CombineMode -> unit
Public Sub SetClip (path As GraphicsPath, combineMode As CombineMode)

매개 변수

path
GraphicsPath

결합할 GraphicsPath입니다.

combineMode
CombineMode

사용할 결합 작업을 지정하는 CombineMode 열거형의 멤버입니다.

예제

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

  • 그래픽 경로를 만들고 경로에 타원을 추가합니다.

  • 멤버를 사용하여 클리핑 영역을 타원 경로로 Replace 설정합니다.

  • 큰 사각형을 단색 검은색 브러시로 채웁니다.

결과는 채워진 검은색 타원입니다.

public:
   void SetClipPathCombine( PaintEventArgs^ e )
   {
      // Create graphics path.
      GraphicsPath^ clipPath = gcnew GraphicsPath;
      clipPath->AddEllipse( 0, 0, 200, 100 );

      // Set clipping region to path.
      e->Graphics->SetClip( clipPath, CombineMode::Replace );

      // Fill rectangle to demonstrate clipping region.
      e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 );
   }
private void SetClipPathCombine(PaintEventArgs e)
{

    // Create graphics path.
    GraphicsPath clipPath = new GraphicsPath();
    clipPath.AddEllipse(0, 0, 200, 100);

    // Set clipping region to path.
    e.Graphics.SetClip(clipPath, CombineMode.Replace);

    // Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(new SolidBrush(Color.Black), 0, 0, 500, 300);
}
Private Sub SetClipPathCombine(ByVal e As PaintEventArgs)

    ' Create graphics path.
    Dim clipPath As New GraphicsPath
    clipPath.AddEllipse(0, 0, 200, 100)

    ' Set clipping region to path.
    e.Graphics.SetClip(clipPath, CombineMode.Replace)

    ' Fill rectangle to demonstrate clipping region.
    e.Graphics.FillRectangle(New SolidBrush(Color.Black), 0, 0, _
    500, 300)
End Sub

설명

매개 변수가 나타내는 path 그래픽 경로가 닫혀 있지 않으면 마지막 지점에서 첫 번째 지점까지 추가 세그먼트가 추가되어 경로를 닫습니다.

적용 대상