다음을 통해 공유


Graphics.TranslateTransform 메서드

정의

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

오버로드

TranslateTransform(Single, Single, MatrixOrder)

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

TranslateTransform(Single, Single)

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

TranslateTransform(Single, Single, MatrixOrder)

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

  • 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

설명

변환 작업은 변환 매트릭스를 dxdy 매개 변수인 행렬을 곱하는 것으로 구성됩니다. 이 메서드는 order 매개 변수에 따라 변환 행렬에 의해 Graphics 변환 매트릭스를 앞에 추가하거나 추가합니다.

추가 정보

적용 대상

TranslateTransform(Single, Single)

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

  • 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

다음 그림에서는 이전 코드 예제 실행의 출력을 보여 줍니다.

번역 및 변환된 타원

설명

원점은 일반적으로 드로잉 표면의 왼쪽 위 모서리입니다. 변환 작업은 변환 매트릭스를 dxdy 매개 변수인 행렬을 곱하는 것으로 구성됩니다. 이 메서드는 변환 행렬 앞에 변환 행렬을 추가하여 변환을 적용합니다.

추가 정보

적용 대상