Help Center

GdipTranslatePenTransformfunction

Translates the local geometric transformation by the specified dimensions. This method prepends the translation to the transformation.

Graphicsfunctiondocumented

Syntax

FUNCTION GdipTranslatePenTransform (BYVAL pen AS GpPen PTR, BYVAL dx AS REAL, BYVAL dy AS REAL, BYVAL order AS GpMatrixOrder) AS GpStatus

Parameters

NameDescription
pen[in] Pointer to the Pen object.
dx[in] Single precision value that specifies the horizontal component of the translation.
dy[in] Single precision value that specifies the vertical component of the translation.
order[in] Element of the MatrixOrder enumeration that specifies the order of the multiplication. MatrixOrderPrepend specifies that the translation matrix is on the left, and MatrixOrderAppend specifies that the translation matrix is on the right. The default value is MatrixOrderPrepend.

Description

Translates the local geometric transformation by the specified dimensions. This method prepends the translation to the transformation.

Example

' ======================================================================================== ' The following example creates a Pen object, applies a translation transform to it, ' and draws two lines—one with the original pen and one with the translated pen. ' ======================================================================================== SUB Example_TranslatePenTransform (BYVAL hdc AS HDC)

DIM hStatus AS LONG

' // Create a graphics object from the device context DIM graphics AS GpGraphics PTR hStatus = GdipCreateFromHDC(hdc, @graphics)

' // Get the DPI scaling ratios DIM dpiX AS SINGLE hStatus = GdipGetDpiX(graphics, @dpiX) DIM rxRatio AS SINGLE = dpiX / 96 DIM dpiY AS SINGLE hStatus = GdipGetDpiY(graphics, @dpiY) Dim ryRatio AS SINGLE = dpiY / 96 ' // Set the scale transform hStatus = GdipScaleWorldTransform(graphics, rxRatio, ryRatio, MatrixOrderPrepend)

' // Create a Pen object DIM pen AS GpPen PTR hStatus = GdipCreatePen1(ARGB_BLUE, 10, UnitWorld, @pen)

' // Draw a line with the original pen hStatus = GdipDrawLine(graphics, pen, 50, 50, 300, 50)

' // Translate the pen's transform hStatus = GdipTranslatePenTransform(pen, 10, 10, MatrixOrderPrepend)

' // Draw a second line with the translated pen hStatus = GdipDrawLine(graphics, pen, 50, 100, 300, 100)

' // Cleanup IF pen THEN GdipDeletePen(pen) IF graphics THEN GdipDeleteGraphics(graphics)

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

Reference

  • Defined in AfxNova/AfxGdiPlus.bi:2329
  • Documented in Graphics/GdiPlus Flat Api/GdiPlusPen.md
  • Topic: GdiPlusPen