Matrix.TransformPoints 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
对点数组应用此 Matrix 所表示的几何转换。
重载
TransformPoints(Point[]) |
对指定的点数组应用此 Matrix 所表示的几何变换。 |
TransformPoints(PointF[]) |
对指定的点数组应用此 Matrix 所表示的几何变换。 |
TransformPoints(Point[])
- Source:
- Matrix.cs
- Source:
- Matrix.cs
- Source:
- Matrix.cs
对指定的点数组应用此 Matrix 所表示的几何变换。
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())
参数
示例
下面的代码示例旨在与 Windows 窗体 一起使用,它需要 PaintEventArgse
事件Paint对象。 此代码执行以下操作:
创建构成矩形的点数组。
在 (蓝色矩形) 应用缩放转换之前,将 (此点数组绘制到屏幕。
创建一个矩阵,并在 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
适用于
TransformPoints(PointF[])
- Source:
- Matrix.cs
- Source:
- Matrix.cs
- Source:
- Matrix.cs
对指定的点数组应用此 Matrix 所表示的几何变换。
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())
参数
示例
有关示例,请参见 TransformPoints(Point[])。
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈