Prepends the specified translation to the transformation matrix of this Graphics object.
Overload List
Prepends the specified translation to the transformation matrix of this Graphics object.
[Visual Basic] Overloads Public Sub TranslateTransform(Single, Single)
[C#] public void TranslateTransform(float, float);
[C++] public: void TranslateTransform(float, float);
[JScript] public function TranslateTransform(float, float);
Applies the specified translation to the transformation matrix of this Graphics object in the specified order.
[Visual Basic] Overloads Public Sub TranslateTransform(Single, Single, MatrixOrder)
[C#] public void TranslateTransform(float, float, MatrixOrder);
[C++] public: void TranslateTransform(float, float, MatrixOrder);
[JScript] public function TranslateTransform(float, float, MatrixOrder);
Example
[Visual Basic, C#] The following example is designed for use with Windows Forms, and it requires PaintEventArgs e, 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.
- Translates the world transformation by a vector (100.0F, 0.0F), appending the translation with MatrixOrder.Append.
- Draws a rotated, translated ellipse with a blue pen.
[Visual Basic, C#] Note This example shows how to use one of the overloaded versions of TranslateTransform. For other examples that might be available, see the individual overload topics.
[Visual Basic]
Public Sub TranslateTransformAngleMatrixOrder(e As PaintEventArgs)
' Set world transform of graphics object to rotate.
e.Graphics.RotateTransform(30F)
' Then to translate, appending to world transform.
e.Graphics.TranslateTransform(100F, 0F, MatrixOrder.Append)
' Draw rotated, translated ellipse to screen.
e.Graphics.DrawEllipse(New Pen(Color.Blue, 3), 0, 0, 200, 80)
End Sub
[C#]
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(new Pen(Color.Blue, 3), 0, 0, 200, 80);
}
[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button
in the upper-left corner of the page.
See Also
Graphics Class | Graphics Members | System.Drawing Namespace