Help Center

CGpPen.TranslateTransformmethod

Updates this brush's current transformation matrix with the product of itself and a translation matrix.

GraphicsmethodCGpPen.incdocumented

Syntax

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

Parameters

NameDescription
dxSingle precision number that specifies the horizontal component of the translation.
dySingle precision number that specifies the 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 Ok, 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 brush's current transformation matrix with the product of itself and a translation matrix.

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 pen AS CGpPen = ARGB_RED pen.RotateTransform(30.0, MatrixOrderAppend) graphics.TranslateTransform(100.0, 50.0, MatrixOrderAppend) graphics.DrawEllipse(@pen, 0, 0, 200, 80)

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

Reference

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