TX Spell .NET for Windows Forms

High DPI and Display Scaling

Topic

Screens with 150 or 200 percent scaling, and setups that mix a 4K monitor with a standard one, are common today. Since version 8.0, the dialogs of TX Spell .NET for Windows Forms are per-monitor DPI aware: they are drawn for the scale factor of the monitor they are on, and scale again when the user moves the application to another monitor or changes the scale factor while it runs. Whether they do this depends on one setting of your application.

Which Dialogs Scale

Two dialogs of TX Spell .NET adapt to the display:

On a 4K screen, the dialog keeps its layout and stays readable:

TX Text Control Words with the Spelling dialog twice: small on the left, and on the right scaled to a 4K display, with the misspelled word doucment and the suggestions document, documents and docent.

Nothing in TX Spell .NET has to be set for this. Per-monitor scaling is a mode of the whole Windows Forms application, and the application switches it on.

Switch On Per-Monitor Scaling in .NET

In a .NET 8 or later application, call Application.SetHighDpiMode with HighDpiMode.PerMonitorV2 in Main, before the first form is created:

[STAThread]
static void Main()
{
    Application.EnableVisualStyles();
    Application.SetHighDpiMode(HighDpiMode.PerMonitorV2);
    Application.SetCompatibleTextRenderingDefault(false);
    Application.Run(new Form1());
}

Switch On Per-Monitor Scaling in .NET Framework

In the .NET Framework, starting with version 4.7, enhanced high DPI support is an opt-in feature of the app.config file. Add this section inside the configuration element:

<System.Windows.Forms.ApplicationConfigurationSection>
  <add key="DpiAwareness" value="PerMonitorV2" />
</System.Windows.Forms.ApplicationConfigurationSection>

Projects for .NET Framework 4.0 to 4.6 can't use this setting. SetHighDpiMode, HighDpiMode and DpiAwareness belong to Windows Forms, not to TX Spell .NET or TX Text Control.

With TX Text Control

The same setting applies to the TextControl, its toolbars and ribbons, which support per-monitor DPI since TX Text Control 29.0. TX Text Control's side of display scaling, with the troubleshooting steps for blurry or wrongly sized controls, is in DPI Scaling of the TX Text Control .NET for Windows Forms documentation.

After an upgrade, check the dialogs on monitors with different scale factors, as Breaking Changes recommends.

Next Steps