TX Text Control .NET for Windows Forms

High DPI and Scaling

Topic

On a display with a scale factor above 100%, or when a window moves between monitors with different scale factors, the editor, its ribbon and its toolbars can look blurry or keep the wrong size. TX Text Control shows no message in these cases: what you see is the symptom. The problems below have a known cause in how the application declares its DPI awareness. High DPI and Display Scaling describes how to set up scaling in a new application.

The Application Looks Blurry on a High-Resolution Display

The TextControl, the ribbon and the dialog boxes look blurry or washed out on a display with a scale factor above 100%.

An application that doesn't declare itself DPI aware is scaled by Windows: the finished image of the window is stretched to the size the display needs, which makes it blurry. TX Text Control draws sharply only in a DPI-aware application, as How TX Text Control Scales explains.

  1. Declare the application DPI aware, as the next section shows.
  2. Rebuild and start the application on the high-resolution display.

The Editor Doesn't Rescale on Another Monitor

The editor has the right size on one monitor, but looks blurry or too small or too large when the window moves to a monitor with another scale factor, or after the user changes the scale factor while the application runs.

Since version 29.0, the TextControl and its toolbars and ribbons rescale when the window moves to another display or the scale factor changes, but only in an application that declares itself per-monitor DPI aware.

  1. In a .NET project, call Application.SetHighDpiMode(HighDpiMode.PerMonitorV2) in Program.cs, as Make a .NET Application DPI Aware shows.
  2. In a .NET Framework 4.7 or later project, add the DpiAwareness key with the value PerMonitorV2 to App.config, as Make a .NET Framework Application DPI Aware shows.
  3. Rebuild the application.

Custom Ribbon Buttons Keep Their Old Icon Size

After the scale factor changes, the built-in ribbon items are sharp and have the right size, but buttons your code added to the ribbon or the application menu keep icons of the old size.

TX Text Control rescales the icons of its own items. An icon your code assigns to a button is a fixed image, and TX Text Control doesn't know how to replace it.

  1. Handle the Windows message WM_DPICHANGED of the form, and set SmallIcon and LargeIcon of each of your buttons again, with images for the new DPI from the ResourceProvider. Give Your Own Ribbon Buttons Sharp Icons shows the code.