GraphicsPath.Transform(Matrix) 메서드
정의
이 GraphicsPath에 변환 매트릭스를 적용합니다.Applies a transform matrix to this GraphicsPath.
public:
void Transform(System::Drawing::Drawing2D::Matrix ^ matrix);
public void Transform (System.Drawing.Drawing2D.Matrix matrix);
member this.Transform : System.Drawing.Drawing2D.Matrix -> unit
매개 변수
예제
다음 코드 예제는 Windows Forms에서 사용 하도록 설계 되었으며 필요 PaintEventArgs e
, OnPaint 이벤트 개체입니다.The following code example is designed for use with Windows Forms, and it requires PaintEventArgse
, an OnPaint event object. 이 코드에서는 다음 작업을 수행합니다.The code performs the following actions:
경로 만들고 타원을 경로에 추가 합니다.Creates a path and adds an ellipse to the path.
화면에 경로 그립니다.Draws path to the screen.
X 축 방향의 경로 100 단위로 변환 하는 변환 행렬을 만듭니다.Creates a transform matrix to translate the path 100 units in the x-axis direction.
화면에 변환 된 경로 그립니다.Draws the transformed path to the screen.
원래 타원 검정색에서 그려지는 변형 된 타원 빨간색에서 그려지는 유의 하십시오.Notice that the original ellipse is drawn in black and the transformed ellipse is drawn in red.
private:
void TransformExample( PaintEventArgs^ e )
{
// Create a path and add and ellipse.
GraphicsPath^ myPath = gcnew GraphicsPath;
myPath->AddEllipse( 0, 0, 100, 200 );
// Draw the starting position to screen.
e->Graphics->DrawPath( Pens::Black, myPath );
// Move the ellipse 100 points to the right.
Matrix^ translateMatrix = gcnew Matrix;
translateMatrix->Translate( 100, 0 );
myPath->Transform(translateMatrix);
// Draw the transformed ellipse to the screen.
e->Graphics->DrawPath( gcnew Pen( Color::Red,2.0f ), myPath );
}
private void TransformExample(PaintEventArgs e)
{
// Create a path and add and ellipse.
GraphicsPath myPath = new GraphicsPath();
myPath.AddEllipse(0, 0, 100, 200);
// Draw the starting position to screen.
e.Graphics.DrawPath(Pens.Black, myPath);
// Move the ellipse 100 points to the right.
Matrix translateMatrix = new Matrix();
translateMatrix.Translate(100, 0);
myPath.Transform(translateMatrix);
// Draw the transformed ellipse to the screen.
e.Graphics.DrawPath(new Pen(Color.Red, 2), myPath);
}
Public Sub TransformExample(ByVal e As PaintEventArgs)
' Create a path and add and ellipse.
Dim myPath As New GraphicsPath
myPath.AddEllipse(0, 0, 100, 200)
' Draw the starting position to screen.
e.Graphics.DrawPath(Pens.Black, myPath)
' Move the ellipse 100 points to the right.
Dim translateMatrix As New Matrix
translateMatrix.Translate(100, 0)
myPath.Transform(translateMatrix)
' Draw the transformed ellipse to the screen.
e.Graphics.DrawPath(New Pen(Color.Red, 2), myPath)
End Sub
설명
변환 수 크기 조정, 변환, 회전 하거나 기울일는 GraphicsPath합니다.The transformation can scale, translate, rotate, or skew the GraphicsPath.