Note
Always try to use the GetScale(Control) overload in the first place. If the graphics object is not associated with a control (e.g. when it is created from a bitmap),
it may return unexpected results.
public static PointF GetScale(
this Graphics graphics
)<ExtensionAttribute>
Public Shared Function GetScale (
graphics As Graphics
) As PointFpublic:
[ExtensionAttribute]
static PointF GetScale(
Graphics^ graphics
)[<ExtensionAttribute>]
static member GetScale :
graphics : Graphics -> PointF If the process is not per-monitor DPI aware, the result is based on the DpiX and DpiY properties of the graphics object. Otherwise, it attempts to retrieve the scaling of the window that the graphics object is associated with. If no such window is found, it falls back to the DpiX and DpiY properties.