Matrix.TransformPoints Metodo

Definizione

Applica la trasformazione geometrica rappresentata dalla classe Matrix a una matrice di punti.

Overload

TransformPoints(Point[])

Applica la trasformazione geometrica rappresentata dalla classe Matrix a una matrice di punti specificata.

TransformPoints(PointF[])

Applica la trasformazione geometrica rappresentata dalla classe Matrix a una matrice di punti specificata.

TransformPoints(Point[])

Origine:
Matrix.cs
Origine:
Matrix.cs
Origine:
Matrix.cs

Applica la trasformazione geometrica rappresentata dalla classe Matrix a una matrice di punti specificata.

public:
 void TransformPoints(cli::array <System::Drawing::Point> ^ pts);
public void TransformPoints (System.Drawing.Point[] pts);
member this.TransformPoints : System.Drawing.Point[] -> unit
Public Sub TransformPoints (pts As Point())

Parametri

pts
Point[]

Matrice di strutture Point che rappresenta i punti da trasformare.

Esempio

L'esempio di codice seguente è progettato per l'uso con Windows Forms e richiede PaintEventArgse, un Paint oggetto evento. Il codice esegue le azioni seguenti:

  • Crea una matrice di punti che formano un rettangolo.

  • Disegna questa matrice di punti (allo schermo prima di applicare una trasformazione di ridimensionamento (il rettangolo blu).

  • Crea una matrice e lo ridimensiona per 3 nell'asse x e 2 nell'asse y.

  • Applica questa trasformazione matrice alla matrice di punti.

  • Disegna la matrice trasformata sullo schermo (rettangolo rosso).

Si noti che il rettangolo rosso è stato ridimensionato da un fattore di 3 nell'asse x e da 2 nell'asse y, incluso l'angolo superiore sinistro del rettangolo (il punto iniziale del rettangolo).

public:
   void TransformPointsExample( PaintEventArgs^ e )
   {
      Pen^ myPen = gcnew Pen( Color::Blue,1.0f );
      Pen^ myPen2 = gcnew Pen( Color::Red,1.0f );

      // Create an array of points.
      array<Point>^ myArray = {Point(20,20),Point(120,20),Point(120,120),Point(20,120),Point(20,20)};

      // Draw the Points to the screen before applying the
      // transform.
      e->Graphics->DrawLines( myPen, myArray );

      // Create a matrix and scale it.
      Matrix^ myMatrix = gcnew Matrix;
      myMatrix->Scale( 3, 2, MatrixOrder::Append );
      myMatrix->TransformPoints( myArray );

      // Draw the Points to the screen again after applying the
      // transform.
      e->Graphics->DrawLines( myPen2, myArray );
   }
public void TransformPointsExample(PaintEventArgs e)
{
    Pen myPen = new Pen(Color.Blue, 1);
    Pen myPen2 = new Pen(Color.Red, 1);
             
    // Create an array of points.
    Point[] myArray =
             {
                 new Point(20, 20),
                 new Point(120, 20),
                 new Point(120, 120),
                 new Point(20, 120),
                 new Point(20,20)
             };
             
    // Draw the Points to the screen before applying the
    // transform.
    e.Graphics.DrawLines(myPen, myArray);
             
    // Create a matrix and scale it.
    Matrix myMatrix = new Matrix();
    myMatrix.Scale(3, 2, MatrixOrder.Append);
    myMatrix.TransformPoints(myArray);
             
    // Draw the Points to the screen again after applying the
    // transform.
    e.Graphics.DrawLines(myPen2, myArray);
}
Public Sub TransformPointsExample(ByVal e As PaintEventArgs)
    Dim myPen As New Pen(Color.Blue, 1)
    Dim myPen2 As New Pen(Color.Red, 1)

    ' Create an array of points.
    Dim myArray As Point() = {New Point(20, 20), New Point(120, 20), _
    New Point(120, 120), New Point(20, 120), New Point(20, 20)}

    ' Draw the Points to the screen before applying the
    ' transform.
    e.Graphics.DrawLines(myPen, myArray)

    ' Create a matrix and scale it.
    Dim myMatrix As New Matrix
    myMatrix.Scale(3, 2, MatrixOrder.Append)
    myMatrix.TransformPoints(myArray)

    ' Draw the Points to the screen again after applying the
    ' transform.
    e.Graphics.DrawLines(myPen2, myArray)
End Sub

Si applica a

TransformPoints(PointF[])

Origine:
Matrix.cs
Origine:
Matrix.cs
Origine:
Matrix.cs

Applica la trasformazione geometrica rappresentata dalla classe Matrix a una matrice di punti specificata.

public:
 void TransformPoints(cli::array <System::Drawing::PointF> ^ pts);
public void TransformPoints (System.Drawing.PointF[] pts);
member this.TransformPoints : System.Drawing.PointF[] -> unit
Public Sub TransformPoints (pts As PointF())

Parametri

pts
PointF[]

Matrice di strutture PointF che rappresenta i punti da trasformare.

Esempio

Per un esempio, vedere TransformPoints(Point[]).

Si applica a