Help Center

CGpGraphics.GetPageScalemethod

Gets the scaling factor currently set for the page transformation of this **Graphics** object.

GraphicsmethodCGpGraphics.incdocumented

Syntax

FUNCTION GetPageScale () AS SINGLE

Description

Gets the scaling factor currently set for the page transformation of this Graphics object. The page transformation converts page coordinates to device coordinates.

Example

' ======================================================================================== ' The following example sets the world and page transformations of a Graphics object. The ' page scale and page unit both belong to the page transformation. The code demonstrates ' how to obtain the page scale (which is already known in this case). The code determines ' whether the page scale is greater than 1 and, if so, sets the page unit to UnitMillimeter. ' The call to Graphics.DrawRectangle draws a rectangle that has a width of 3 centimeters ' (UnitMillimeter along with a scaling factor of 10) and a height of 2 centimeters. ' ======================================================================================== SUB Example_GetPageScale (BYVAL hdc AS HDC)

' // Create a graphics object from the window device context DIM graphics AS CGpGraphics = hdc

DIM blackPen AS CGpPen = CGpPen(ARGB_BLACK)

'// Set the world transformation of the Graphics object. graphics.TranslateTransform(4, 1)

' // Set the page transformation of the Graphics object. graphics.SetPageUnit(UnitInch) graphics.SetPageScale(10)

DIM pageScale AS SINGLE = graphics.GetPageScale IF pageScale > 1 THEN graphics.SetPageUnit(UnitMillimeter)

graphics.DrawRectangle(@blackPen, 0, 0, 3, 2)

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

Reference

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