Region.Transform(Matrix) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
public:
void Transform(System::Drawing::Drawing2D::Matrix ^ matrix);
public void Transform (System.Drawing.Drawing2D.Matrix matrix);
member this.Transform : System.Drawing.Drawing2D.Matrix -> unit
Public Sub Transform (matrix As Matrix)
매개 변수
예외
matrix
이(가) null
인 경우
예제
다음 코드 예제는 Windows Forms 사용하도록 설계되었으며 이벤트 처리기의 Paint 매개 변수인 가 필요합니다.PaintEventArgse
코드는 다음 작업을 수행합니다.
사각형을 만들어 화면에 파란색으로 그립니다.
사각형에서 영역을 만듭니다.
변환 행렬을 만들고 45도로 설정합니다.
변환을 지역에 적용합니다.
변환된 영역을 빨간색으로 채우고 변환된 영역을 화면에 빨간색으로 그립니다.
빨간색 사각형은 파란색으로 표시된 원래 사각형에서 45도 회전됩니다.
public:
void TransformExample( PaintEventArgs^ e )
{
// Create the first rectangle and draw it to the screen in blue.
Rectangle regionRect = Rectangle(100,50,100,100);
e->Graphics->DrawRectangle( Pens::Blue, regionRect );
// Create a region using the first rectangle.
System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect );
// Create a transform matrix and set it to have a 45 degree
// rotation.
Matrix^ transformMatrix = gcnew Matrix;
transformMatrix->RotateAt( 45, Point(100,50) );
// Apply the transform to the region.
myRegion->Transform(transformMatrix);
// Fill the transformed region with red and draw it to the screen
// in red.
SolidBrush^ myBrush = gcnew SolidBrush( Color::Red );
e->Graphics->FillRegion( myBrush, myRegion );
}
public void TransformExample(PaintEventArgs e)
{
// Create the first rectangle and draw it to the screen in blue.
Rectangle regionRect = new Rectangle(100, 50, 100, 100);
e.Graphics.DrawRectangle(Pens.Blue, regionRect);
// Create a region using the first rectangle.
Region myRegion = new Region(regionRect);
// Create a transform matrix and set it to have a 45 degree
// rotation.
Matrix transformMatrix = new Matrix();
transformMatrix.RotateAt(45, new Point(100, 50));
// Apply the transform to the region.
myRegion.Transform(transformMatrix);
// Fill the transformed region with red and draw it to the screen
// in red.
SolidBrush myBrush = new SolidBrush(Color.Red);
e.Graphics.FillRegion(myBrush, myRegion);
}
Public Sub TransformExample(ByVal e As PaintEventArgs)
' Create the first rectangle and draw it to the screen in blue.
Dim regionRect As New Rectangle(100, 50, 100, 100)
e.Graphics.DrawRectangle(Pens.Blue, regionRect)
' Create a region using the first rectangle.
Dim myRegion As New [Region](regionRect)
' Create a transform matrix and set it to have a 45 degree
' rotation.
Dim transformMatrix As New Matrix
transformMatrix.RotateAt(45, New PointF(100, 50))
' Apply the transform to the region.
myRegion.Transform(transformMatrix)
' Fill the transformed region with red and draw it to the
' screen in red.
Dim myBrush As New SolidBrush(Color.Red)
e.Graphics.FillRegion(myBrush, myRegion)
End Sub
적용 대상
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기