Graphics.ResetClip 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이 Graphics의 클립 영역을 무한 영역으로 다시 설정합니다.
public:
void ResetClip();
public void ResetClip ();
member this.ResetClip : unit -> unit
Public Sub ResetClip ()
예제
다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse
코드는 다음 작업을 수행합니다.
왼쪽 위 모서리가 (0, 0)인 사각형을 만들고 클리핑 영역을 이 사각형으로 설정합니다.
왼쪽 위 모서리가 (100, 100)인 두 번째 사각형을 만들고 클리핑 영역을 이 사각형과 현재 클리핑 영역(첫 번째 사각형)의 교집합으로 설정합니다.
이전 사각형을 모두 포함하는 큰 사각형을 단색 파란색 브러시로 채웁니다.
클리핑 영역을 무한으로 다시 설정합니다.
두 클리핑 영역 주위에 사각형을 그립니다. 첫 번째 클리핑 사각형에는 검은색 펜을 사용하고 두 번째 클리핑 영역에는 빨간색 펜을 사용합니다.
그 결과 두 사각형의 교차점만 파란색으로 채워집니다.
public:
void IntersectClipRectangleF2( 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 IntersectClipRectangleF2(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 IntersectClipRectangleF2(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
설명
의 Graphics 클리핑 영역이 무한하면 이 Graphics 그리는 항목이 잘리지 않습니다.
적용 대상
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기