Graphics.TranslateTransform メソッド

定義

この Graphics の変換行列の前に指定の平行移動を付加することによって、座標系の原点を変更します。

オーバーロード

TranslateTransform(Single, Single, MatrixOrder)

この Graphics の変換行列に指定の平行移動を指定の順序で適用することによって、座標系の原点を変更します。

TranslateTransform(Single, Single)

この Graphics の変換行列の前に指定の平行移動を付加することによって、座標系の原点を変更します。

TranslateTransform(Single, Single, MatrixOrder)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

この Graphics の変換行列に指定の平行移動を指定の順序で適用することによって、座標系の原点を変更します。

public:
 void TranslateTransform(float dx, float dy, System::Drawing::Drawing2D::MatrixOrder order);
public void TranslateTransform (float dx, float dy, System.Drawing.Drawing2D.MatrixOrder order);
member this.TranslateTransform : single * single * System.Drawing.Drawing2D.MatrixOrder -> unit
Public Sub TranslateTransform (dx As Single, dy As Single, order As MatrixOrder)

パラメーター

dx
Single

平行移動する x 座標。

dy
Single

平行移動する y 座標。

order
MatrixOrder

平行移動が変換行列の前に付加されるか後に追加されるかを指定する MatrixOrder 列挙体のメンバー。

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • Windows フォームのワールド変換マトリックスを 30.0F 度回転します。

  • を呼び出 TranslateTransformしてグラフィックス オブジェクトの原点を移動し、ワールド変換マトリックスに変換を追加します。

  • 回転した翻訳された楕円を青いペンで描画します。

public:
   void TranslateTransformAngleMatrixOrder( PaintEventArgs^ e )
   {
      // Set world transform of graphics object to rotate.
      e->Graphics->RotateTransform( 30.0F );

      // Then to translate, appending to world transform.
      e->Graphics->TranslateTransform( 100.0F, 0.0F, MatrixOrder::Append );

      // Draw rotated, translated ellipse to screen.
      e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), 0, 0, 200, 80 );
   }
private void TranslateTransformAngleMatrixOrder(PaintEventArgs e)
{

    // Set world transform of graphics object to rotate.
    e.Graphics.RotateTransform(30.0F);

    // Then to translate, appending to world transform.
    e.Graphics.TranslateTransform(100.0F, 0.0F, MatrixOrder.Append);

    // Draw rotated, translated ellipse to screen.
    e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
}
Private Sub TranslateTransformAngleMatrixOrder(ByVal e As PaintEventArgs)

    ' Set world transform of graphics object to rotate.
    e.Graphics.RotateTransform(30.0F)

    ' Then to translate, appending to world transform.
    e.Graphics.TranslateTransform(100.0F, 0.0F, MatrixOrder.Append)

    ' Draw rotated, translated ellipse to screen.
    e.Graphics.DrawEllipse(New Pen(Color.Blue, 3), 0, 0, 200, 80)
End Sub

注釈

変換演算は、変換行列に変換部分 dx が および dy パラメーターである行列を乗算して構成されます。 このメソッドは、 パラメーターに従って、 の変換行列の Graphics 前に変換行列を order 追加します。

こちらもご覧ください

適用対象

TranslateTransform(Single, Single)

ソース:
Graphics.cs
ソース:
Graphics.cs
ソース:
Graphics.cs

この Graphics の変換行列の前に指定の平行移動を付加することによって、座標系の原点を変更します。

public:
 void TranslateTransform(float dx, float dy);
public void TranslateTransform (float dx, float dy);
member this.TranslateTransform : single * single -> unit
Public Sub TranslateTransform (dx As Single, dy As Single)

パラメーター

dx
Single

平行移動する x 座標。

dy
Single

平行移動する y 座標。

次のコード例は、Windows フォームで使用するように設計されており、イベント ハンドラーのPaintパラメーターである が必要PaintEventArgseです。 コードは、次のアクションを実行します。

  • Windows フォームのワールド変換マトリックスを 30.0F 度回転します。

  • を呼び出 TranslateTransformしてグラフィックス オブジェクトの原点を移動し、変換マトリックスへの変換を開始します。

  • 青いペンを使用して、平行移動された回転楕円を描画します。

public:
   void TranslateTransformAngle( PaintEventArgs^ e )
   {
      // Set world transform of graphics object to rotate.
      e->Graphics->RotateTransform( 30.0F );

      // Then to translate, prepending to world transform.
      e->Graphics->TranslateTransform( 100.0F, 0.0F );

      // Draw translated, rotated ellipse to screen.
      e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), 0, 0, 200, 80 );
   }
private void TranslateTransformAngle(PaintEventArgs e)
{

    // Set world transform of graphics object to rotate.
    e.Graphics.RotateTransform(30.0F);

    // Then to translate, prepending to world transform.
    e.Graphics.TranslateTransform(100.0F, 0.0F);

    // Draw translated, rotated ellipse to screen.
    e.Graphics.DrawEllipse(new Pen(Color.Blue, 3), 0, 0, 200, 80);
}
Private Sub TranslateTransformAngle(ByVal e As PaintEventArgs)

    ' Set world transform of graphics object to rotate.
    e.Graphics.RotateTransform(30.0F)

    ' Then to translate, prepending to world transform.
    e.Graphics.TranslateTransform(100.0F, 0.0F)

    ' Draw translated, rotated ellipse to screen.
    e.Graphics.DrawEllipse(New Pen(Color.Blue, 3), 0, 0, 200, 80)
End Sub

次の図は、前のコード例の実行の出力を示しています。

変換された楕円と変換された楕円

注釈

原点は通常、描画サーフェスの左上隅です。 変換演算は、変換行列に変換部分 dx が および dy パラメーターである行列を乗算して構成されます。 このメソッドは、変換行列を変換行列に事前に設定して翻訳を適用します。

こちらもご覧ください

適用対象