CGpGraphics.SetTransformmethod
Sets the world transformation of this **Graphics** object.
Syntax
FUNCTION SetTransform (BYVAL pMatrix AS CGpMatrix PTR) AS GpStatus
Parameters
| Name | Description | |
|---|---|---|
pMatrix | Pointer to a Matrix object that specifies the world transformation. |
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
Sets the world transformation of this Graphics object.
Example
' ======================================================================================== ' The following example creates a rotation matrix and passes the address of that matrix to ' the Graphics.SetTransform method of a Graphics object. The code calls the Graphics.DrawRectangle ' method of the Graphics object to draw a rotated rectangle. ' ======================================================================================== SUB Example_SetTransform (BYVAL hdc AS HDC)
' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc ' // Get the DPI scaling ratio DIM rxRatio AS SINGLE = graphics.GetDpiX / 96 DIM ryRatio AS SINGLE = graphics.GetDpiY / 96
' // Create a rotation matrix. DIM transformMatrix AS CGpMatrix transformMatrix.Rotate(45.0!) ' // Adjust to DPI transformMatrix.Scale(rxRatio, rxRatio)
' // Set the transformation matrix of the Graphics object. graphics.SetTransform(@transformMatrix)
' // Draw a rotated rectangle. DIM blackPen AS CGpPen = CGpPen(ARGB_BLACK) graphics.DrawRectangle(@blackPen, 120, 0, 100, 50)
END SUB ' ========================================================================================
Reference
- Include file
CGpGraphics.inc - Defined in AfxNova/CGpGraphics.inc:273
- Documented in Graphics/GdiPlus Classes/CGpGraphics Classes.md
- Topic: CGpGraphics Class