Graphics.TranslateTransform Method (Single, Single, MatrixOrder)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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)

member TranslateTransform : 
        dx:float32 *
        dy:float32 *
        order:MatrixOrder -> unit

Parameters

dx
Type: System.Single

The x-coordinate of the translation.

dy
Type: System.Single

The y-coordinate of the translation.

order
Type: System.Drawing.Drawing2D.MatrixOrder

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.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: