DPI Methods

Stator | API Documentation

The DPI type exposes the following members.

Methods

  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodStatic membergetResourceNameForScaling
Return the resource name [string] with suffix to support current scaling factor

equals 100% = no suffix
less than or equal 125% = _120DPI
less than or equal 150% = _144DPI
less than or equal 250% = _192DPI
less than or equal 350% = _288DPI
less than or equal 450% = _384DPI
else no suffix

Usage example: You have a graphic resource called "icon.png" with multiple versions to support different scaling factors. Add an appropriate suffix to each filename (resource name) and then use this function to return the correct graphic for the device scaling factor.

Public methodStatic membergetScaledSize
Will return a size object (width and height) adjusted to the current scaling factor
Pass in the base width and height and this function will convert to the display scaling factor
Public methodStatic membergetScalingFactor
Return the scaling factor (as float) for the current display.

Example:
1.25 = 125%
2.00 = 200% etc
4.00 = 400%
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Top
See Also

Reference