CGpGraphics.ScaleTransformForDPimethod
Updates this Graphic object's current transformation matrix with the product of itself and a scaling matrix. Uses the DPI settings to set the horizontal and vertical scaling factors in the scaling matrix.
Syntax
FUNCTION ScaleTransformForDPi (BYVAL order AS MatrixOrder = MatrixOrderPrepend) AS GpStatus
ScaleTransform — one description covers them all.Parameters
| Name | Description | |
|---|---|---|
sx | Optional. The horizontal scaling factor in the scaling matrix. | |
sy | Optional The vertical scaling factor in the scaling matrix. | |
order | Optional. 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 scaling matrix.
Example
' ======================================================================================== ' The following example sets the world transformation of a Graphics object to a translation. ' The call to GdipScaleWorldTransform multiplies the Graphics object's existing world ' transformation matrix (translation) by a scaling matrix. The MatrixOrderAppend argument ' specifies that the multiplication is done with the scaling matrix on the right. At that ' point, the world transformation matrix of the Graphics object represents a composite ' transformation: first translate, then scale. The call to GdipDrawEllipse draws a translated ' and scaled ellipse. ' ======================================================================================== SUB Example_ScaleTransform (BYVAL hdc AS HDC)
' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Set the scale transform DIM rxRatio AS SINGLE = graphics.GetDpiX / 96 DIM ryRatio AS SINGLE = graphics.GetDpiY / 96 graphics.ScaleTransform(rxRatio, ryRatio)
' // Create pen with DPI-aware width DIM pen AS CGpPen = CGpPen(ARGB_BLUE, 1.0 * rxRatio, UnitPixel)
' Apply translation first graphics.TranslateTransform(70.0, 70.0, MatrixOrderAppend) ' Apply scaling after translation graphics.ScaleTransform(3.0, 1.0, MatrixOrderAppend)
' Draw ellipse with composite transformation graphics.DrawEllipse(@pen, 0, 0, 50, 50)
END SUB ' ========================================================================================
Reference
- Include file
CGpGraphics.inc - Defined in AfxNova/CGpGraphics.inc:317
- Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
- Topic: CGpGraphics Class