Graphics.TransformPoints メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
この Graphics の現在のワールド変換とページ変換を使用して、点の配列をある座標空間から別の座標空間に変換します。
オーバーロード
TransformPoints(CoordinateSpace, CoordinateSpace, Point[]) |
この Graphics の現在のワールド変換とページ変換を使用して、点の配列をある座標空間から別の座標空間に変換します。 |
TransformPoints(CoordinateSpace, CoordinateSpace, PointF[]) |
この Graphics の現在のワールド変換とページ変換を使用して、点の配列をある座標空間から別の座標空間に変換します。 |
TransformPoints(CoordinateSpace, CoordinateSpace, Point[])
- ソース:
- Graphics.cs
- ソース:
- Graphics.cs
- ソース:
- Graphics.cs
この Graphics の現在のワールド変換とページ変換を使用して、点の配列をある座標空間から別の座標空間に変換します。
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);
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())
パラメーター
- destSpace
- CoordinateSpace
変換先の座標空間を指定する CoordinateSpace 列挙体のメンバー。
- srcSpace
- CoordinateSpace
変換元の座標空間を指定する CoordinateSpace 列挙体のメンバー。
例
次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgse
です。 コードは、次のアクションを実行します。
2 つの点を作成し、それらの間に青い線を描画します。
ワールド変換を x 方向に 40、y 方向に 30 の量で変換するように設定します。
ワールド変換を ID にリセットします。
変換されたポイントの間に赤い線を描画します。
結果は青い線で、その下に赤い線が翻訳されます。
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
適用対象
TransformPoints(CoordinateSpace, CoordinateSpace, PointF[])
- ソース:
- Graphics.cs
- ソース:
- Graphics.cs
- ソース:
- Graphics.cs
この Graphics の現在のワールド変換とページ変換を使用して、点の配列をある座標空間から別の座標空間に変換します。
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);
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())
パラメーター
- destSpace
- CoordinateSpace
変換先の座標空間を指定する CoordinateSpace 列挙体のメンバー。
- srcSpace
- CoordinateSpace
変換元の座標空間を指定する CoordinateSpace 列挙体のメンバー。
例
次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgse
です。 コードは、次のアクションを実行します。
2 つの点を作成し、それらの間に青い線を描画します。
ワールド変換を x 方向に 40、y 方向に 30 の量で変換するように設定します。
ワールド変換を ID にリセットし、変換されたポイント間に赤い線を描画します。
結果は青い線で、その下に赤い線が翻訳されます。
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
適用対象
.NET
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示