Lire en anglais

Partager via


Matrix.TransformPoints Méthode

Définition

Applique la transformation géométrique que cette Matrix représente à un tableau de points.

Surcharges

TransformPoints(ReadOnlySpan<PointF>)
TransformPoints(ReadOnlySpan<Point>)
TransformPoints(PointF[])

Applique la transformation géométrique représentée par cette Matrix à un tableau de points spécifié.

TransformPoints(Point[])

Applique la transformation géométrique représentée par cette Matrix à un tableau de points spécifié.

TransformPoints(ReadOnlySpan<PointF>)

Source:
Matrix.cs
C#
public void TransformPoints (scoped ReadOnlySpan<System.Drawing.PointF> pts);

Paramètres

S’applique à

.NET 9 et Windows Desktop 9
Produit Versions
.NET 9
Windows Desktop 9

TransformPoints(ReadOnlySpan<Point>)

Source:
Matrix.cs
C#
public void TransformPoints (scoped ReadOnlySpan<System.Drawing.Point> pts);

Paramètres

S’applique à

.NET 9 et Windows Desktop 9
Produit Versions
.NET 9
Windows Desktop 9

TransformPoints(PointF[])

Source:
Matrix.cs
Source:
Matrix.cs
Source:
Matrix.cs
Source:
Matrix.cs
Source:
Matrix.cs

Applique la transformation géométrique représentée par cette Matrix à un tableau de points spécifié.

C#
public void TransformPoints (System.Drawing.PointF[] pts);
C#
public void TransformPoints (params System.Drawing.PointF[] pts);

Paramètres

pts
PointF[]

Tableau de structures PointF qui représente les points à transformer.

Exemples

Pour obtenir un exemple, consultez TransformPoints(Point[]).

S’applique à

.NET 9 et autres versions
Produit Versions
.NET 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

TransformPoints(Point[])

Source:
Matrix.cs
Source:
Matrix.cs
Source:
Matrix.cs
Source:
Matrix.cs
Source:
Matrix.cs

Applique la transformation géométrique représentée par cette Matrix à un tableau de points spécifié.

C#
public void TransformPoints (System.Drawing.Point[] pts);
C#
public void TransformPoints (params System.Drawing.Point[] pts);

Paramètres

pts
Point[]

Tableau de structures Point qui représente les points à transformer.

Exemples

L’exemple de code suivant est conçu pour être utilisé avec Windows Forms et nécessite PaintEventArgse, un objet d’événement Paint. Le code effectue les actions suivantes :

  • Crée un tableau de points qui forment un rectangle.

  • Dessine ce tableau de points (à l’écran avant d’appliquer une transformation de mise à l’échelle (rectangle bleu).

  • Crée une matrice et la met à l’échelle de 3 dans l’axe x et 2 dans l’axe y.

  • Applique cette transformation de matrice au tableau de points.

  • Dessine le tableau transformé à l’écran (rectangle rouge).

Notez que le rectangle rouge a été mis à l’échelle par un facteur de 3 dans l’axe x et par 2 dans l’axe y, y compris le coin supérieur gauche du rectangle (point de début du rectangle).

C#
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);
}

S’applique à

.NET 9 et autres versions
Produit Versions
.NET 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9