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

지정된 순서로 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

설명

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

추가 정보

적용 대상

TranslateTransform(Single, Single)

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

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

번역 및 변환된 타원

설명

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

추가 정보

적용 대상