Graphics.TransformPoints Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mengubah array titik dari satu ruang koordinat ke ruang koordinat lainnya menggunakan transformasi dunia dan halaman saat ini dari Graphicsini.
Overload
TransformPoints(CoordinateSpace, CoordinateSpace, Point[]) |
Mengubah array titik dari satu ruang koordinat ke ruang koordinat lainnya menggunakan transformasi dunia dan halaman saat ini dari Graphicsini. |
TransformPoints(CoordinateSpace, CoordinateSpace, PointF[]) |
Mengubah array titik dari satu ruang koordinat ke ruang koordinat lainnya menggunakan transformasi dunia dan halaman saat ini dari Graphicsini. |
TransformPoints(CoordinateSpace, CoordinateSpace, ReadOnlySpan<Point>) | |
TransformPoints(CoordinateSpace, CoordinateSpace, ReadOnlySpan<PointF>) |
TransformPoints(CoordinateSpace, CoordinateSpace, Point[])
- Sumber:
- Graphics.cs
- Sumber:
- Graphics.cs
- Sumber:
- Graphics.cs
- Sumber:
- Graphics.cs
- Sumber:
- Graphics.cs
Mengubah array titik dari satu ruang koordinat ke ruang koordinat lainnya menggunakan transformasi dunia dan halaman saat ini dari Graphicsini.
public:
void TransformPoints(System::Drawing::Drawing2D::CoordinateSpace destSpace, System::Drawing::Drawing2D::CoordinateSpace srcSpace, cli::array <System::Drawing::Point> ^ pts);
public:
void TransformPoints(System::Drawing::Drawing2D::CoordinateSpace destSpace, System::Drawing::Drawing2D::CoordinateSpace srcSpace, ... cli::array <System::Drawing::Point> ^ pts);
public void TransformPoints (System.Drawing.Drawing2D.CoordinateSpace destSpace, System.Drawing.Drawing2D.CoordinateSpace srcSpace, System.Drawing.Point[] pts);
public void TransformPoints (System.Drawing.Drawing2D.CoordinateSpace destSpace, System.Drawing.Drawing2D.CoordinateSpace srcSpace, params System.Drawing.Point[] pts);
member this.TransformPoints : System.Drawing.Drawing2D.CoordinateSpace * System.Drawing.Drawing2D.CoordinateSpace * System.Drawing.Point[] -> unit
Public Sub TransformPoints (destSpace As CoordinateSpace, srcSpace As CoordinateSpace, pts As Point())
Public Sub TransformPoints (destSpace As CoordinateSpace, srcSpace As CoordinateSpace, ParamArray pts As Point())
Parameter
- destSpace
- CoordinateSpace
Anggota enumerasi CoordinateSpace yang menentukan ruang koordinat tujuan.
- srcSpace
- CoordinateSpace
Anggota enumerasi CoordinateSpace yang menentukan ruang koordinat sumber.
Contoh
Contoh kode berikut dirancang untuk digunakan dengan Windows Forms, dan memerlukan PaintEventArgse
, yang merupakan parameter penanganan aktivitas Paint. Kode melakukan tindakan berikut:
Membuat dua poin dan menggambar garis biru di antaranya.
Mengatur transformasi dunia untuk diterjemahkan dengan jumlah 40 ke arah x dan 30 ke arah y.
Mengubah titik dari koordinat dunia (World) menjadi koordinat halaman (Page).
Mengatur ulang transformasi dunia ke identitas.
Menggambar garis merah di antara titik yang diubah.
Hasilnya adalah garis biru dan garis merah yang diterjemahkan di bawahnya.
public:
void TransformPointsPoint( PaintEventArgs^ e )
{
// Create array of two points.
array<Point>^ points = {Point(0,0),Point(100,50)};
// Draw line connecting two untransformed points.
e->Graphics->DrawLine( gcnew Pen( Color::Blue,3.0f ), points[ 0 ], points[ 1 ] );
// Set world transformation of Graphics object to translate.
e->Graphics->TranslateTransform( 40, 30 );
// Transform points in array from world to page coordinates.
e->Graphics->TransformPoints( CoordinateSpace::Page, CoordinateSpace::World, points );
// Reset world transformation.
e->Graphics->ResetTransform();
// Draw line that connects transformed points.
e->Graphics->DrawLine( gcnew Pen( Color::Red,3.0f ), points[ 0 ], points[ 1 ] );
}
private void TransformPointsPoint(PaintEventArgs e)
{
// Create array of two points.
Point[] points = { new Point(0, 0), new Point(100, 50) };
// Draw line connecting two untransformed points.
e.Graphics.DrawLine(new Pen(Color.Blue, 3), points[0], points[1]);
// Set world transformation of Graphics object to translate.
e.Graphics.TranslateTransform(40, 30);
// Transform points in array from world to page coordinates.
e.Graphics.TransformPoints(CoordinateSpace.Page, CoordinateSpace.World, points);
// Reset world transformation.
e.Graphics.ResetTransform();
// Draw line that connects transformed points.
e.Graphics.DrawLine(new Pen(Color.Red, 3), points[0], points[1]);
}
Private Sub TransformPointsPoint(ByVal e As PaintEventArgs)
' Create array of two points.
Dim points As Point() = {New Point(0, 0), New Point(100, 50)}
' Draw line connecting two untransformed points.
e.Graphics.DrawLine(New Pen(Color.Blue, 3), points(0), points(1))
' Set world transformation of Graphics object to translate.
e.Graphics.TranslateTransform(40, 30)
' Transform points in array from world to page coordinates.
e.Graphics.TransformPoints(CoordinateSpace.Page, _
CoordinateSpace.World, points)
' Reset world transformation.
e.Graphics.ResetTransform()
' Draw line that connects transformed points.
e.Graphics.DrawLine(New Pen(Color.Red, 3), points(0), points(1))
End Sub
Berlaku untuk
TransformPoints(CoordinateSpace, CoordinateSpace, PointF[])
- Sumber:
- Graphics.cs
- Sumber:
- Graphics.cs
- Sumber:
- Graphics.cs
- Sumber:
- Graphics.cs
- Sumber:
- Graphics.cs
Mengubah array titik dari satu ruang koordinat ke ruang koordinat lainnya menggunakan transformasi dunia dan halaman saat ini dari Graphicsini.
public:
void TransformPoints(System::Drawing::Drawing2D::CoordinateSpace destSpace, System::Drawing::Drawing2D::CoordinateSpace srcSpace, cli::array <System::Drawing::PointF> ^ pts);
public:
void TransformPoints(System::Drawing::Drawing2D::CoordinateSpace destSpace, System::Drawing::Drawing2D::CoordinateSpace srcSpace, ... cli::array <System::Drawing::PointF> ^ pts);
public void TransformPoints (System.Drawing.Drawing2D.CoordinateSpace destSpace, System.Drawing.Drawing2D.CoordinateSpace srcSpace, System.Drawing.PointF[] pts);
public void TransformPoints (System.Drawing.Drawing2D.CoordinateSpace destSpace, System.Drawing.Drawing2D.CoordinateSpace srcSpace, params System.Drawing.PointF[] pts);
member this.TransformPoints : System.Drawing.Drawing2D.CoordinateSpace * System.Drawing.Drawing2D.CoordinateSpace * System.Drawing.PointF[] -> unit
Public Sub TransformPoints (destSpace As CoordinateSpace, srcSpace As CoordinateSpace, pts As PointF())
Public Sub TransformPoints (destSpace As CoordinateSpace, srcSpace As CoordinateSpace, ParamArray pts As PointF())
Parameter
- destSpace
- CoordinateSpace
Anggota enumerasi CoordinateSpace yang menentukan ruang koordinat tujuan.
- srcSpace
- CoordinateSpace
Anggota enumerasi CoordinateSpace yang menentukan ruang koordinat sumber.
Contoh
Contoh kode berikut dirancang untuk digunakan dengan Windows Forms, dan memerlukan PaintEventArgse
, yang merupakan parameter penanganan aktivitas Paint. Kode melakukan tindakan berikut:
Membuat dua poin dan menggambar garis biru di antaranya.
Mengatur transformasi dunia untuk diterjemahkan dengan jumlah 40 ke arah x dan 30 ke arah y.
Mengubah titik dari koordinat dunia (World) menjadi koordinat halaman (Page).
Mengatur ulang transformasi dunia ke identitas dan menggambar garis merah antara titik yang diubah.
Hasilnya adalah garis biru dan garis merah yang diterjemahkan di bawahnya.
public:
void TransformPointsPointF( PaintEventArgs^ e )
{
// Create array of two points.
array<PointF>^ points = {PointF(0.0F,0.0F),PointF(100.0F,50.0F)};
// Draw line connecting two untransformed points.
e->Graphics->DrawLine( gcnew Pen( Color::Blue,3.0f ), points[ 0 ], points[ 1 ] );
// Set world transformation of Graphics object to translate.
e->Graphics->TranslateTransform( 40.0F, 30.0F );
// Transform points in array from world to page coordinates.
e->Graphics->TransformPoints( CoordinateSpace::Page, CoordinateSpace::World, points );
// Reset world transformation.
e->Graphics->ResetTransform();
// Draw line that connects transformed points.
e->Graphics->DrawLine( gcnew Pen( Color::Red,3.0f ), points[ 0 ], points[ 1 ] );
}
private void TransformPointsPointF(PaintEventArgs e)
{
// Create array of two points.
PointF[] points = { new PointF(0.0F, 0.0F), new PointF(100.0F, 50.0F) };
// Draw line connecting two untransformed points.
e.Graphics.DrawLine(new Pen(Color.Blue, 3), points[0], points[1]);
// Set world transformation of Graphics object to translate.
e.Graphics.TranslateTransform(40.0F, 30.0F);
// Transform points in array from world to page coordinates.
e.Graphics.TransformPoints(CoordinateSpace.Page, CoordinateSpace.World, points);
// Reset world transformation.
e.Graphics.ResetTransform();
// Draw line that connects transformed points.
e.Graphics.DrawLine(new Pen(Color.Red, 3), points[0], points[1]);
}
Private Sub TransformPointsPointF(ByVal e As PaintEventArgs)
' Create array of two points.
Dim points As PointF() = {New PointF(0.0F, 0.0F), New PointF(100.0F, _
50.0F)}
' Draw line connecting two untransformed points.
e.Graphics.DrawLine(New Pen(Color.Blue, 3), points(0), points(1))
' Set world transformation of Graphics object to translate.
e.Graphics.TranslateTransform(40.0F, 30.0F)
' Transform points in array from world to page coordinates.
e.Graphics.TransformPoints(CoordinateSpace.Page, _
CoordinateSpace.World, points)
' Reset world transformation.
e.Graphics.ResetTransform()
' Draw line that connects transformed points.
e.Graphics.DrawLine(New Pen(Color.Red, 3), points(0), points(1))
End Sub
Berlaku untuk
TransformPoints(CoordinateSpace, CoordinateSpace, ReadOnlySpan<Point>)
- Sumber:
- Graphics.cs
public:
void TransformPoints(System::Drawing::Drawing2D::CoordinateSpace destSpace, System::Drawing::Drawing2D::CoordinateSpace srcSpace, ReadOnlySpan<System::Drawing::Point> pts);
public void TransformPoints (System.Drawing.Drawing2D.CoordinateSpace destSpace, System.Drawing.Drawing2D.CoordinateSpace srcSpace, scoped ReadOnlySpan<System.Drawing.Point> pts);
member this.TransformPoints : System.Drawing.Drawing2D.CoordinateSpace * System.Drawing.Drawing2D.CoordinateSpace * ReadOnlySpan<System.Drawing.Point> -> unit
Public Sub TransformPoints (destSpace As CoordinateSpace, srcSpace As CoordinateSpace, pts As ReadOnlySpan(Of Point))
Parameter
- destSpace
- CoordinateSpace
- srcSpace
- CoordinateSpace
- pts
- ReadOnlySpan<Point>
Berlaku untuk
TransformPoints(CoordinateSpace, CoordinateSpace, ReadOnlySpan<PointF>)
- Sumber:
- Graphics.cs
public:
void TransformPoints(System::Drawing::Drawing2D::CoordinateSpace destSpace, System::Drawing::Drawing2D::CoordinateSpace srcSpace, ReadOnlySpan<System::Drawing::PointF> pts);
public void TransformPoints (System.Drawing.Drawing2D.CoordinateSpace destSpace, System.Drawing.Drawing2D.CoordinateSpace srcSpace, scoped ReadOnlySpan<System.Drawing.PointF> pts);
member this.TransformPoints : System.Drawing.Drawing2D.CoordinateSpace * System.Drawing.Drawing2D.CoordinateSpace * ReadOnlySpan<System.Drawing.PointF> -> unit
Public Sub TransformPoints (destSpace As CoordinateSpace, srcSpace As CoordinateSpace, pts As ReadOnlySpan(Of PointF))
Parameter
- destSpace
- CoordinateSpace
- srcSpace
- CoordinateSpace
- pts
- ReadOnlySpan<PointF>