Help Center

CGpGraphics.TranslateTransformmethod

Updates this **Graphics** object's world transformation matrix with the product of itself and a translation matrix.

GraphicsmethodCGpGraphics.incdocumented

Syntax

FUNCTION TranslateTransform (BYVAL dx AS SINGLE, BYVAL dy AS SINGLE, BYVAL order AS MatrixOrder = MatrixOrderPrepend) AS GpStatus

Parameters

NameDescription
dxThe horizontal component of the translation.
dyThe vertical component of the translation.
orderOptional. Element of the MatrixOrder enumeration that specifies the order of multiplication. MatrixOrderPrepend specifies that the passed matrix is on the left, and MatrixOrderAppend specifies that the passed matrix is on the right. The default value is MatrixOrderPrepend.

Return value

If the function succeeds, it returns StatusOk, which is an element of the GpStatus enumeration.

If the function fails, it returns one of the other elements of the GpStatus enumeration.

Description

Updates this Graphics object's world transformation matrix with the product of itself and a translation matrix.

Remarks

Not implemented in the C++ classes.

Example

' ======================================================================================== ' The following example sets the world transformation of a Graphics object to a rotation. ' The call to Graphics.TranslateTransform multiplies the Graphics object's existing world ' transformation matrix (rotation) by a translation matrix. The MatrixOrderAppend argument ' specifies that the multiplication is done with the translation matrix on the right. At ' that point, the world transformation matrix of the Graphics object represents a composite ' transformation: first rotate, then translate. The call to DrawEllipse draws a rotated ' and translated ellipse. ' ======================================================================================== SUB Example_TranslateTransform (BYVAL hdc AS HDC)

' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform graphics.ScaleTransformForDpi

DIM redPen AS CGpPen = CGpPen(ARGB_RED) graphics.RotateTransform(30) graphics.TranslateTransform(100, 50, MatrixOrderAppend) graphics.DrawEllipse(@redPen, 0, 0, 200, 80)

END SUB ' ========================================================================================

Reference

  • Include file CGpGraphics.inc
  • Defined in AfxNova/CGpGraphics.inc:298
  • Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
  • Topic: CGpGraphics Class