Class DisplayScaleTracker
Tracks the display scale of a native window by polling an IDisplayScaleProvider.
public sealed class DisplayScaleTracker
- Inheritance
-
DisplayScaleTracker
- Inherited Members
- Extension Methods
Remarks
Engine integrations create one per render context and call Poll() once per update. Polling is a single cheap OS call and avoids competing with the engine for its window event queue.
Constructors
DisplayScaleTracker(IDisplayScaleProvider, Func<NativeWindowInfo>)
Initializes a new instance of the DisplayScaleTracker class.
public DisplayScaleTracker(IDisplayScaleProvider provider, Func<NativeWindowInfo> windowSource)
Parameters
providerIDisplayScaleProviderThe provider used to read the scale, typically GetProvider().
windowSourceFunc<NativeWindowInfo>A callback returning the current native window info. It must not throw.
Properties
Scale
Gets the display scale read by the last Poll() call; 1.0 before the first poll.
public float Scale { get; }
Property Value
Methods
Poll()
public bool Poll()
Returns
Remarks
Values that aren't finite and greater than zero are treated as 1.0.
Events
Changed
public event EventHandler? Changed