GraphicsPath.Transform メソッド
アセンブリ: System.Drawing (system.drawing.dll 内)



次のコード例は、Windows フォームでの使用を意図してデザインされており、OnPaint イベント オブジェクトである PaintEventArgse が必要です。このコードは次のアクションを実行します。
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
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); }
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.get_Graphics().DrawPath(Pens.get_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.get_Graphics().DrawPath(new Pen(Color.get_Red(), 2), myPath); } //TransformExample

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- GraphicsPath.Transform メソッドのページへのリンク