Graphics.ResetTransform 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이 Graphics의 전역 변환 매트릭스를 항등 매트릭스로 다시 설정합니다.
public:
void ResetTransform();
public void ResetTransform ();
member this.ResetTransform : unit -> unit
Public Sub ResetTransform ()
예제
다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse
코드는 다음 작업을 수행합니다.
Windows Form의 월드 변환을 벡터(100, 0)로 변환합니다.
폼의 그래픽 상태를 저장합니다.
폼의 월드 변환을 ID로 다시 설정하고 사각형을 단색 빨간색 브러시로 채웁니다.
변환된 그래픽 상태를 복원하고 사각형을 단색 파란색 브러시로 채웁니다.
그 결과 변환되지 않은 빨간색으로 채워진 사각형과 변환된 파란색으로 채워진 사각형이 생성됩니다.
public:
void SaveRestore1( PaintEventArgs^ e )
{
// Translate transformation matrix.
e->Graphics->TranslateTransform( 100, 0 );
// Save translated graphics state.
GraphicsState^ transState = e->Graphics->Save();
// Reset transformation matrix to identity and fill rectangle.
e->Graphics->ResetTransform();
e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0, 0, 100, 100 );
// Restore graphics state to translated state and fill second
// rectangle.
e->Graphics->Restore( transState );
e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 100, 100 );
}
private void SaveRestore1(PaintEventArgs e)
{
// Translate transformation matrix.
e.Graphics.TranslateTransform(100, 0);
// Save translated graphics state.
GraphicsState transState = e.Graphics.Save();
// Reset transformation matrix to identity and fill rectangle.
e.Graphics.ResetTransform();
e.Graphics.FillRectangle(new SolidBrush(Color.Red), 0, 0, 100, 100);
// Restore graphics state to translated state and fill second
// rectangle.
e.Graphics.Restore(transState);
e.Graphics.FillRectangle(new SolidBrush(Color.Blue), 0, 0, 100, 100);
}
Private Sub SaveRestore1(ByVal e As PaintEventArgs)
' Translate transformation matrix.
e.Graphics.TranslateTransform(100, 0)
' Save translated graphics state.
Dim transState As GraphicsState = e.Graphics.Save()
' Reset transformation matrix to identity and fill rectangle.
e.Graphics.ResetTransform()
e.Graphics.FillRectangle(New SolidBrush(Color.Red), 0, 0, 100, 100)
' Restore graphics state to translated state and fill second
' rectangle.
e.Graphics.Restore(transState)
e.Graphics.FillRectangle(New SolidBrush(Color.Blue), 0, 0, _
100, 100)
End Sub
설명
ID 행렬은 크기 조정, 회전 또는 변환이 없는 변환을 나타냅니다. 이 Graphics 월드 변환을 ID 행렬로 다시 설정하면 월드 변환이 변환된 항목의 기하 도형을 변경하지 않습니다.
적용 대상
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기