SftStyle/NET 3.0 supports per-monitor DPI awareness (Per-Monitor v2). In a per-monitor aware application, the slider adapts when its window moves to a monitor with a different scale factor: the track, the thumbs, the ticks and the labels are sized for the monitor's DPI. The message box, the task dialog and the color dialog are laid out for the DPI of the monitor they appear on, and the dark mode painting of the SftStyle component (buttons, check boxes, group boxes, tab controls) follows the DPI of each control.
A Windows Forms application becomes per-monitor aware with this setting in its app.config file (.NET Framework 4.7 or later), together with Windows 10 compatibility in its application manifest:
<System.Windows.Forms.ApplicationConfigurationSection> <add key="DpiAwareness" value="PerMonitorV2" /> </System.Windows.Forms.ApplicationConfigurationSection>
A .NET 10 application becomes per-monitor aware by calling Application.SetHighDpiMode(HighDpiMode.PerMonitorV2) before it creates its first window.
On .NET Framework, in an application that is per-monitor DPI aware, Windows Forms does not scale a form that opens on a monitor with a different scale factor than the one the form was laid out for: the form keeps its layout under a title bar sized for the monitor. When a form moves to such a monitor, Windows Forms leaves some standard controls drawing their text in a small font: a TextBox, ComboBox or ListView in a GroupBox, and the edit box of a NumericUpDown anywhere. The SftStyle component corrects both on every form of the application, in light and dark mode: it scales a form that opens on such a monitor before the form is shown, as a move to that monitor would, and gives those controls their rescaled font. .NET 10 does both itself.
The SftStyle.Scaling event occurs before the component scales a form or a control. Setting Cancel in its event data leaves the form, with its controls, or the control as Windows Forms made it, for example a custom control that handles the scale factor itself. The event does not occur on .NET 10 and later.
In both frameworks, Windows Forms gives a DataGridView and a ListView their new font after such a move, but keeps the column widths, the row heights and the header sizes of a DataGridView and the column widths of a ListView in pixels as they were. An application whose grids should follow the scale factor resizes them in the form's DpiChanged event.
The slider's DeviceDpi property returns the DPI of the monitor showing the control, and the DpiChangedAfterParent event occurs when it changes. Both are inherited from the Control class. The SftStyle/NET samples are per-monitor aware.
Applications that are only DPI aware for the primary monitor (System DPI aware) get the same scaling at the system DPI.