Utilities to support DPI scaling
Inheritance Hierarchy
Stator.libPublic.UtilitiesDPI
Namespace: Stator.libPublic.Utilities
Assembly: libPublic (in libPublic.dll) Version: 4.0.2018.0 (4.0.18103)
Syntax
The DPI type exposes the following members.
Constructors
Name | Description | |
---|---|---|
DPI |
Constructor for DPI class. Will store the scale factor in property "scalingFactor" to avoid calculating the scale at each request |
Methods
Name | Description | |
---|---|---|
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
GetHashCode | (Inherited from Object.) | |
getResourceNameForScaling |
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. | |
getScaledSize |
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 | |
getScalingFactor |
Return the scaling factor (as float) for the current display. Example: 1.25 = 125% 2.00 = 200% etc 4.00 = 400% | |
GetType | (Inherited from Object.) | |
MemberwiseClone | (Inherited from Object.) | |
ToString | (Inherited from Object.) |
Fields
Name | Description | |
---|---|---|
scalingFactor |
Instatiate the DPI class and this property will contain the current scaling factor for the device running this code
|
See Also