Graphics.SetClip Graphics.SetClip Graphics.SetClip Graphics.SetClip Method

정의

Graphics의 클립 영역을 지정된 GraphicsClip 속성으로 설정합니다.Sets the clipping region of this Graphics to the Clip property of the specified Graphics.

오버로드

SetClip(Region, CombineMode) SetClip(Region, CombineMode) SetClip(Region, CombineMode)

현재 클립 영역과 지정된 Graphics를 결합하는 지정된 작업의 결과로 이 Region의 클립 영역을 설정합니다.Sets the clipping region of this Graphics to the result of the specified operation combining the current clip region and the specified Region.

SetClip(RectangleF, CombineMode) SetClip(RectangleF, CombineMode) SetClip(RectangleF, CombineMode)

현재 클립 영역과 Graphics 구조체에 의해 지정된 사각형을 결합하는 지정된 작업의 결과로 이 RectangleF의 클립 영역을 설정합니다.Sets the clipping region of this Graphics to the result of the specified operation combining the current clip region and the rectangle specified by a RectangleF structure.

SetClip(Rectangle, CombineMode) SetClip(Rectangle, CombineMode) SetClip(Rectangle, CombineMode)

현재 클립 영역과 Graphics 구조체에 의해 지정된 사각형을 결합하는 지정된 작업의 결과로 이 Rectangle의 클립 영역을 설정합니다.Sets the clipping region of this Graphics to the result of the specified operation combining the current clip region and the rectangle specified by a Rectangle structure.

SetClip(GraphicsPath, CombineMode) SetClip(GraphicsPath, CombineMode) SetClip(GraphicsPath, CombineMode)

현재 클립 영역과 지정된 Graphics를 결합하는 지정된 작업의 결과로 이 GraphicsPath의 클립 영역을 설정합니다.Sets the clipping region of this Graphics to the result of the specified operation combining the current clip region and the specified GraphicsPath.

SetClip(Graphics, CombineMode) SetClip(Graphics, CombineMode) SetClip(Graphics, CombineMode)

현재 클립 영역과 지정된 GraphicsClip 속성의 지정된 결합 작업의 결과로 이 Graphics의 클립 영역을 설정합니다.Sets the clipping region of this Graphics to the result of the specified combining operation of the current clip region and the Clip property of the specified Graphics.

SetClip(Rectangle) SetClip(Rectangle) SetClip(Rectangle) SetClip(Rectangle)

Graphics의 클립 영역을 Rectangle 구조체에 의해 지정된 사각형으로 설정합니다.Sets the clipping region of this Graphics to the rectangle specified by a Rectangle structure.

SetClip(Graphics) SetClip(Graphics) SetClip(Graphics) SetClip(Graphics)

Graphics의 클립 영역을 지정된 GraphicsClip 속성으로 설정합니다.Sets the clipping region of this Graphics to the Clip property of the specified Graphics.

SetClip(GraphicsPath) SetClip(GraphicsPath) SetClip(GraphicsPath) SetClip(GraphicsPath)

Graphics의 클립 영역을 지정된 GraphicsPath로 설정합니다.Sets the clipping region of this Graphics to the specified GraphicsPath.

SetClip(RectangleF) SetClip(RectangleF) SetClip(RectangleF) SetClip(RectangleF)

Graphics의 클립 영역을 RectangleF 구조체에 의해 지정된 사각형으로 설정합니다.Sets the clipping region of this Graphics to the rectangle specified by a RectangleF structure.

SetClip(Region, CombineMode) SetClip(Region, CombineMode) SetClip(Region, CombineMode)

현재 클립 영역과 지정된 Graphics를 결합하는 지정된 작업의 결과로 이 Region의 클립 영역을 설정합니다.Sets the clipping region of this Graphics to the result of the specified operation combining the current clip region and the specified 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

매개 변수

region
Region Region Region Region

결합할 Region입니다.Region to combine.

combineMode
CombineMode CombineMode CombineMode CombineMode

사용할 결합 작업을 지정하는 CombineMode 열거형의 멤버입니다.Member from the CombineMode enumeration that specifies the combining operation to use.

예제

다음 코드 예제는 Windows Forms에서 사용 하도록 설계 되었으며 필요 PaintEventArgs e의 매개 변수는 Paint 이벤트 처리기입니다.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. 이 코드에서는 다음 작업을 수행합니다.The code performs the following actions:

  • 클리핑 영역에 대 한 작은 사각형을 만듭니다.Creates a small rectangle for the clipping region.

  • 클리핑 영역을 사각형으로 설정 된 Replace 멤버입니다.Sets the clipping region to the rectangle with the Replace member.

  • 검은색 단색 브러시를 사용 하 여 큰 사각형을 채웁니다.Fills a large rectangle with a solid black brush.

결과는 소규모, 채워진, 검은색 사각형입니다.The result is a small, filled, black rectangle.

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) SetClip(RectangleF, CombineMode) SetClip(RectangleF, CombineMode)

현재 클립 영역과 Graphics 구조체에 의해 지정된 사각형을 결합하는 지정된 작업의 결과로 이 RectangleF의 클립 영역을 설정합니다.Sets the clipping region of this Graphics to the result of the specified operation combining the current clip region and the rectangle specified by a RectangleF structure.

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

매개 변수

rect
RectangleF RectangleF RectangleF RectangleF

결합할 RectangleF 구조체입니다.RectangleF structure to combine.

combineMode
CombineMode CombineMode CombineMode CombineMode

사용할 결합 작업을 지정하는 CombineMode 열거형의 멤버입니다.Member of the CombineMode enumeration that specifies the combining operation to use.

예제

다음 코드 예제는 Windows Forms에서 사용 하도록 설계 되었으며 필요 PaintEventArgs e의 매개 변수는 Paint 이벤트 처리기입니다.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. 이 코드에서는 다음 작업을 수행합니다.The code performs the following actions:

  • 클리핑 영역에 대 한 작은 사각형을 만듭니다.Creates a small rectangle for the clipping region.

  • 클리핑 영역을 사각형으로 설정 된 Replace 멤버입니다.Sets the clipping region to the rectangle with the Replace member.

  • 검은색 단색 브러시를 사용 하 여 큰 사각형을 채웁니다.Fills a large rectangle with a solid black brush.

결과는 소규모, 채워진, 검은색 사각형입니다.The result is a small, filled, black rectangle.

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) SetClip(Rectangle, CombineMode) SetClip(Rectangle, CombineMode)

현재 클립 영역과 Graphics 구조체에 의해 지정된 사각형을 결합하는 지정된 작업의 결과로 이 Rectangle의 클립 영역을 설정합니다.Sets the clipping region of this Graphics to the result of the specified operation combining the current clip region and the rectangle specified by a Rectangle structure.

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

매개 변수

rect
Rectangle Rectangle Rectangle Rectangle

결합할 Rectangle 구조체입니다.Rectangle structure to combine.

combineMode
CombineMode CombineMode CombineMode CombineMode

사용할 결합 작업을 지정하는 CombineMode 열거형의 멤버입니다.Member of the CombineMode enumeration that specifies the combining operation to use.

예제

다음 코드 예제는 Windows Forms에서 사용 하도록 설계 되었으며 필요 PaintEventArgs e의 매개 변수는 Paint 이벤트 처리기입니다.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. 이 코드에서는 다음 작업을 수행합니다.The code performs the following actions:

  • 클리핑 영역에 대 한 작은 사각형을 만듭니다.Creates a small rectangle for the clipping region.

  • 클리핑 영역을 사각형으로 설정 된 Replace 멤버입니다.Sets the clipping region to the rectangle with the Replace member.

  • 검은색 단색 브러시를 사용 하 여 큰 사각형을 채웁니다.Fills a large rectangle with a solid black brush.

결과는 소규모, 채워진, 검은색 사각형입니다.The result is a small, filled, black rectangle.

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(GraphicsPath, CombineMode) SetClip(GraphicsPath, CombineMode) SetClip(GraphicsPath, CombineMode)

현재 클립 영역과 지정된 Graphics를 결합하는 지정된 작업의 결과로 이 GraphicsPath의 클립 영역을 설정합니다.Sets the clipping region of this Graphics to the result of the specified operation combining the current clip region and the specified 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

매개 변수

combineMode
CombineMode CombineMode CombineMode CombineMode

사용할 결합 작업을 지정하는 CombineMode 열거형의 멤버입니다.Member of the CombineMode enumeration that specifies the combining operation to use.

예제

다음 코드 예제는 Windows Forms에서 사용 하도록 설계 되었으며 필요 PaintEventArgs e의 매개 변수는 Paint 이벤트 처리기입니다.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. 이 코드에서는 다음 작업을 수행합니다.The code performs the following actions:

  • 그래픽 경로 만들고 타원을 경로에 추가 합니다.Creates a graphics path and adds an ellipse to the path.

  • 클리핑 영역을 사용 하 여 타원형 경로로 설정 된 Replace 멤버입니다.Sets the clipping region to the elliptical path with the Replace member.

  • 검은색 단색 브러시를 사용 하 여 큰 사각형을 채웁니다.Fills a large rectangle with a solid black brush.

결과 검은색, 채워진 타원을 합니다.The result is a filled, black ellipse.

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 매개 변수 닫혀 있지 않으며, 추가 세그먼트가에 추가 됩니다 마지막 지점에서 첫 번째 요소 경로를 닫습니다.If the graphics path represented by the path parameter is not closed, an additional segment is added from the last point to the first point to close the path.

SetClip(Graphics, CombineMode) SetClip(Graphics, CombineMode) SetClip(Graphics, CombineMode)

현재 클립 영역과 지정된 GraphicsClip 속성의 지정된 결합 작업의 결과로 이 Graphics의 클립 영역을 설정합니다.Sets the clipping region of this Graphics to the result of the specified combining operation of the current clip region and the Clip property of the specified 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

매개 변수

g
Graphics Graphics Graphics Graphics

결합할 클립 영역을 지정하는 Graphics입니다.Graphics that specifies the clip region to combine.

combineMode
CombineMode CombineMode CombineMode CombineMode

사용할 결합 작업을 지정하는 CombineMode 열거형의 멤버입니다.Member of the CombineMode enumeration that specifies the combining operation to use.

예제

다음 코드 예제는 Windows Forms에서 사용 하도록 설계 되었으며 필요 PaintEventArgs e의 매개 변수인를 Paint 이벤트 처리기 뿐만 thisForm, Form 예입니다.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler, as well as thisForm, the Form for the example. 이 코드에서는 다음 작업을 수행합니다.The code performs the following actions:

  • 임시 만듭니다 Graphics 에서 합니다 thisForm Form 예제입니다.Creates a temporary Graphics from the thisFormForm of the example.

  • 임시의 클립 영역을 설정 Graphics 작은 사각형으로 합니다.Sets the clipping region of the temporary Graphics to a small square.

  • 폼의 그래픽 개체의 클립 영역을 새 업데이트 Graphics 사용 하 여는 Replace 멤버입니다.Updates the clipping region of the form's graphic object to that of the new Graphics with the Replace member.

  • 검은색 단색 브러시를 사용 하 여 큰 사각형을 채웁니다.Fills a large rectangle with a solid black brush.

결과는 소규모, 채워진, 검은색 사각형입니다.The result is a small, filled, black square.

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(Rectangle) SetClip(Rectangle) SetClip(Rectangle) SetClip(Rectangle)

Graphics의 클립 영역을 Rectangle 구조체에 의해 지정된 사각형으로 설정합니다.Sets the clipping region of this Graphics to the rectangle specified by a Rectangle structure.

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 Rectangle Rectangle

새 클립 영역을 나타내는 Rectangle 구조체입니다.Rectangle structure that represents the new clip region.

예제

다음 코드 예제는 Windows Forms에서 사용 하도록 설계 되었으며 필요 PaintEventArgs e의 매개 변수는 Paint 이벤트 처리기입니다.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. 이 코드에서는 다음 작업을 수행합니다.The code performs the following actions:

  • 클리핑 영역에 대 한 작은 사각형을 만듭니다.Creates a small rectangle for the clipping region.

  • 사각형에 클립 영역을 설정 합니다.Sets the clipping region to the rectangle.

  • 검은색 단색 브러시를 사용 하 여 큰 사각형을 채웁니다.Fills a large rectangle with a solid black brush.

결과는 소규모, 채워진, 검은색 사각형입니다.The result is a small, filled, black rectangle.

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) SetClip(Graphics) SetClip(Graphics) SetClip(Graphics)

Graphics의 클립 영역을 지정된 GraphicsClip 속성으로 설정합니다.Sets the clipping region of this Graphics to the Clip property of the specified Graphics.

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 Graphics Graphics

새 클립 영역을 가져오는 Graphics입니다.Graphics from which to take the new clip region.

예제

다음 코드 예제는 Windows Forms에서 사용 하도록 설계 되었으며 필요 PaintEventArgs e의 매개 변수인를 Paint 이벤트 처리기 뿐만 thisForm, Form 예입니다.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler, as well as thisForm, the Form for the example. 이 코드에서는 다음 작업을 수행합니다.The code performs the following actions:

  • 임시 만듭니다 Graphics 에서 합니다 thisForm Form 예제입니다.Creates a temporary Graphics from the thisFormForm of the example.

  • 임시의 클립 영역을 설정 Graphics 작은 사각형으로 합니다.Sets the clipping region of the temporary Graphics to a small square.

  • 폼의 그래픽 개체의 클립 영역을 임시 업데이트 Graphics합니다.Updates the clipping region of the form's graphic object to that of the temporary Graphics.

  • 검은색 단색 브러시를 사용 하 여 큰 사각형을 채웁니다.Fills a large rectangle with a solid black brush.

결과는 소규모, 채워진, 검은색 사각형입니다.The result is a small, filled, black square.

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) SetClip(GraphicsPath) SetClip(GraphicsPath) SetClip(GraphicsPath)

Graphics의 클립 영역을 지정된 GraphicsPath로 설정합니다.Sets the clipping region of this Graphics to the specified 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 GraphicsPath GraphicsPath

새 클립 영역을 나타내는 GraphicsPath입니다.GraphicsPath that represents the new clip region.

예제

다음 코드 예제는 Windows Forms에서 사용 하도록 설계 되었으며 필요 PaintEventArgs e의 매개 변수는 Paint 이벤트 처리기입니다.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. 이 코드에서는 다음 작업을 수행합니다.The code performs the following actions:

  • 그래픽 경로 만들고 타원을 경로에 추가 합니다.Creates a graphics path and adds an ellipse to the path.

  • 타원형 경로로 클립 영역을 설정 합니다.Sets the clipping region to the elliptical path.

  • 검은색 단색 브러시를 사용 하 여 큰 사각형을 채웁니다.Fills a large rectangle with a solid black brush.

결과 검은색, 채워진 타원을 합니다.The result is a filled, black ellipse.

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 매개 변수 닫혀 있지 않으며, 추가 세그먼트가에 추가 됩니다 마지막 지점에서 첫 번째 요소 경로를 닫습니다.If the graphics path represented by the path parameter is not closed, an additional segment is added from the last point to the first point to close the path.

SetClip(RectangleF) SetClip(RectangleF) SetClip(RectangleF) SetClip(RectangleF)

Graphics의 클립 영역을 RectangleF 구조체에 의해 지정된 사각형으로 설정합니다.Sets the clipping region of this Graphics to the rectangle specified by a RectangleF structure.

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 RectangleF RectangleF

새 클립 영역을 나타내는 RectangleF 구조체입니다.RectangleF structure that represents the new clip region.

예제

다음 코드 예제는 Windows Forms에서 사용 하도록 설계 되었으며 필요 PaintEventArgs e의 매개 변수는 Paint 이벤트 처리기입니다.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. 이 코드에서는 다음 작업을 수행합니다.The code performs the following actions:

  • 클리핑 영역에 대 한 작은 사각형을 만듭니다.Creates a small rectangle for the clipping region.

  • 사각형에 클립 영역을 설정 합니다.Sets the clipping region to the rectangle.

  • 검은색 단색 브러시를 사용 하 여 큰 사각형을 채웁니다.Fills a large rectangle with a solid black brush.

결과는 소규모, 채워진, 검은색 사각형입니다.The result is a small, filled, black rectangle.

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

적용 대상