Graphics.TranslateTransform 메서드

정의

지정된 변환을 이 Graphics변환 행렬 앞에 추가하여 좌표계의 원점 변경

오버로드

Name Description
TranslateTransform(Single, Single)

지정된 변환을 이 Graphics변환 행렬 앞에 추가하여 좌표계의 원점 변경

TranslateTransform(Single, Single, MatrixOrder)

지정된 순서대로 이 Graphics 변환 행렬에 지정된 변환을 적용하여 좌표계의 원점이 변경됩니다.

TranslateTransform(Single, Single)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
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 Forms 사용하도록 설계되었으며 PaintEventArgs 이벤트 처리기의 매개 변수인 ePaint 필요합니다. 코드는 다음 작업을 수행합니다.

  • Windows Form의 월드 변환 매트릭스를 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. 이 메서드는 변환 행렬 앞에 변환 행렬을 추가하여 변환을 적용합니다.

추가 정보

적용 대상

TranslateTransform(Single, Single, MatrixOrder)

Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
Graphics.cs
Source:
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 Forms 사용하도록 설계되었으며 PaintEventArgs 이벤트 처리기의 매개 변수인 ePaint 필요합니다. 코드는 다음 작업을 수행합니다.

  • Windows Form의 월드 변환 매트릭스를 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 를 앞에 추가하거나 추가합니다.

추가 정보

적용 대상