Graphics.TranslateTransform Method (Single, Single)
Assembly: System.Drawing (in system.drawing.dll)
The origin is typically the upper-left-hand corner of the drawing surface. The translation operation consists of multiplying the transformation matrix by a matrix whose translation part is the dx and dy parameters. This method applies the translation by prepending the translation matrix to the transformation matrix.
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 origin of the graphics object by calling TranslateTransform, prepending the translation to the transformation matrix.
-
Draws a translated, rotated ellipse with a blue pen.
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.