BaseFormDeviceScaleChanged Event
Occurs with per-monitor DPI awareness, when the scale of the form's display device changes, after performing the default processing of the corresponding Windows message.
On platform targets where the
DpiChanged event exists, this event is raised after
DpiChanged.
Namespace: KGySoft.WinForms.FormsAssembly: KGySoft.WinForms (in KGySoft.WinForms.dll) Version: 5.0.1
public event EventHandler<DeviceScaleChangeEventArgs> DeviceScaleChanged
Public Event DeviceScaleChanged As EventHandler(Of DeviceScaleChangeEventArgs)
public:
event EventHandler<DeviceScaleChangeEventArgs^>^ DeviceScaleChanged {
void add (EventHandler<DeviceScaleChangeEventArgs^>^ value);
void remove (EventHandler<DeviceScaleChangeEventArgs^>^ value);
}
member DeviceScaleChanged : IEvent<EventHandler<DeviceScaleChangeEventArgs>,
DeviceScaleChangeEventArgs>
Value
EventHandlerDeviceScaleChangeEventArgs This event is raised only on Windows 8.1 or later, when the application has per-monitor DPI awareness.
On platform targets where the DpiChanged event is also available, this event is raised after DpiChanged.
If you want to prevent auto-scaling by DpiChanged, subscribe DpiChanged as well (or override OnDpiChanged),
and set Cancel in the event arguments to .
In contrast, the arguments of the DeviceScaleChanged event cannot be canceled, but this event does not do anything automatically if not subscribed.
Unlike in the Form.OnGetDpiScaledSize event arguments, the DeviceScaleChangedEventArgs.SuggestedBounds property
contains a scaled size even if AutoScaleMode is None.
The suggested bounds still can be ignored by the subscriber of the event.
You don't need to set the size of the form when handling this event. If you don't set the size, the suggested bounds will be applied automatically.
However, if you set a different size, and per-monitor DPI awareness version is V1, Windows may forcibly reset the suggested size after setting the custom bounds.
To apply a custom size with per-monitor DPI awareness V1, use the
DeviceScaleAutoResized event.