Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Graphics.GetPageScale method

Applies to: desktop apps only

The Graphics::GetPageScale method gets the scaling factor currently set for the page transformation of this Graphics object. The page transformation converts page coordinates to device coordinates.

Syntax

REAL GetPageScale();

Parameters

This method has no parameters.

Return value

Type:

Type: REAL

This method returns the scaling factor currently set for the page transformation of this Graphics object.

Examples

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.


VOID Example_GetPageScale(HDC hdc)
{
   Graphics graphics(hdc);
   Pen pen(Color(255, 0, 0, 0), 0.0f);

   // Set the world transformation of the Graphics object.
   graphics.TranslateTransform(4.0f, 1.0f);

   // Set the page transformation of the Graphics object.
   graphics.SetPageUnit(UnitInch);
   graphics.SetPageScale(10.0f);

   REAL pageScale = graphics.GetPageScale();

   if(pageScale > 1.0f)
      graphics.SetPageUnit(UnitMillimeter);

   graphics.DrawRectangle(&pen, 0, 0, 3, 2);  
}

Requirements

Minimum supported client

Windows XP, Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Product

GDI+ 1.0

Header

Gdiplusgraphics.h (include Gdiplus.h)

Library

Gdiplus.lib

DLL

Gdiplus.dll

See also

Graphics
Graphics::GetDpiX
Graphics::GetDpiY
Graphics::GetPageUnit
Graphics::SetPageScale
Graphics::SetPageUnit
Unit
Types of Coordinate Systems

 

 

Send comments about this topic to Microsoft

Build date: 3/6/2012

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.