This documentation is archived and is not being maintained.

Graphics.TranslateTransform Method (Single, Single, MatrixOrder)

Changes the origin of the coordinate system by applying the specified translation to the transformation matrix of this Graphics in the specified order.

Namespace: System.Drawing
Assembly: System.Drawing (in system.drawing.dll)

public void TranslateTransform (
	float dx,
	float dy,
	MatrixOrder order
public void TranslateTransform (
	float dx, 
	float dy, 
	MatrixOrder order
public function TranslateTransform (
	dx : float, 
	dy : float, 
	order : MatrixOrder
Not applicable.



The x-coordinate of the translation.


The y-coordinate of the translation.


Member of the MatrixOrder enumeration that specifies whether the translation is prepended or appended to the transformation matrix.

The translation operation consists of multiplying the transformation matrix by a matrix whose translation part is the dx and dy parameters. This method prepends or appends the transformation matrix of the Graphics by the translation matrix according to the order parameter.

The following code example is designed for use with Windows Forms, and it requires PaintEventArgse, which is a parameter of the Paint event handler. The code performs the following actions:

  • Rotates the world transformation matrix of the Windows Form by 30.0F degrees.

  • Moves the graphics object's origin by calling TranslateTransform, appending the translation to the world transformation matrix.

  • Draws a rotated, translated ellipse with a blue pen.

private void TranslateTransformAngleMatrixOrder(PaintEventArgs e)

    // Set world transform of graphics object to rotate.

    // 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);

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0