GraphicsPath.Transform(Matrix) Yöntem

Tanım

Bu GraphicsPathbir dönüştürme matrisi uygular.

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)

Parametreler

matrix
Matrix

Matrix Uygulanacak dönüşümü temsil eden bir.

Örnekler

Aşağıdaki kod örneği Windows Forms ile kullanılmak üzere tasarlanmıştır ve bir PaintEventArgs olay nesnesi olan eOnPaint gerektirir. Kod aşağıdaki eylemleri gerçekleştirir:

  • Bir yol oluşturur ve yola üç nokta ekler.

  • Ekrana yol çizer.

  • X ekseni yönünde 100 birimlik yolu çevirmek için bir dönüştürme matrisi oluşturur.

  • Dönüştürülen yolu ekrana çizer.

Özgün üç noktanın siyah, dönüştürülen elipsin ise kırmızıyla çizildiğine dikkat edin.

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

Açıklamalar

Dönüştürme, öğesini ölçeklendirebilir, çevirebilir, döndürebilir veya çarpıtabilir GraphicsPath.

Şunlara uygulanır