Class FixedDisplayScaleProvider
An IDisplayScaleProvider that always reports the same scale.
public sealed class FixedDisplayScaleProvider : IDisplayScaleProvider
- Inheritance
-
FixedDisplayScaleProvider
- Implements
- Inherited Members
- Extension Methods
Remarks
Used as the fallback on platforms without a dedicated provider (see GetProvider()), and useful for tests or for forcing a scale.
Constructors
FixedDisplayScaleProvider(float)
Initializes a new instance of the FixedDisplayScaleProvider class.
public FixedDisplayScaleProvider(float scale = 1)
Parameters
scalefloatThe scale to report. Defaults to
1.0.
Exceptions
- ArgumentOutOfRangeException
scaleis not a finite number greater than zero.
Methods
GetScale(in NativeWindowInfo)
Gets the display scale of the specified window, where 1.0 means 96 DPI (100 %).
public float GetScale(in NativeWindowInfo window)
Parameters
windowNativeWindowInfoThe native window to query.
Returns
- float
The display scale. Implementations must not throw; they return
1.0when the scale can't be determined.