Matrix.TransformPoints 方法

定义

将此 Matrix 表示的几何转换应用于点数组。

重载

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

将此 Matrix 表示的几何变换应用于指定的点数组。

TransformPoints(Point[])

将此 Matrix 表示的几何变换应用于指定的点数组。

TransformPoints(ReadOnlySpan<PointF>)

Source:
Matrix.cs
public:
 void TransformPoints(ReadOnlySpan<System::Drawing::PointF> pts);
public void TransformPoints (scoped ReadOnlySpan<System.Drawing.PointF> pts);
member this.TransformPoints : ReadOnlySpan<System.Drawing.PointF> -> unit
Public Sub TransformPoints (pts As ReadOnlySpan(Of PointF))

参数

适用于

TransformPoints(ReadOnlySpan<Point>)

Source:
Matrix.cs
public:
 void TransformPoints(ReadOnlySpan<System::Drawing::Point> pts);
public void TransformPoints (scoped ReadOnlySpan<System.Drawing.Point> pts);
member this.TransformPoints : ReadOnlySpan<System.Drawing.Point> -> unit
Public Sub TransformPoints (pts As ReadOnlySpan(Of Point))

参数

适用于

TransformPoints(PointF[])

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

将此 Matrix 表示的几何变换应用于指定的点数组。

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

参数

pts
PointF[]

表示要转换的点的 PointF 结构的数组。

示例

有关示例,请参阅 TransformPoints(Point[])

适用于

TransformPoints(Point[])

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

将此 Matrix 表示的几何变换应用于指定的点数组。

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

参数

pts
Point[]

表示要转换的点的 Point 结构的数组。

示例

下面的代码示例旨在与 Windows 窗体一起使用,它需要 PaintEventArgsePaint 事件对象。 该代码执行以下操作:

  • 创建构成矩形的点数组。

  • 绘制此点数组(在应用缩放转换之前在屏幕上)(蓝色矩形)。

  • 创建矩阵并将其缩放为 x 轴中的 3,在 y 轴中创建 2。

  • 将此矩阵转换应用于点数组。

  • 将转换后的数组绘制到屏幕(红色矩形)。

请注意,红色矩形已按 x 轴中的 3 因子缩放,在 y 轴中缩放 2,包括矩形的左上角(矩形的起点)。

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

适用于