Windows Forms advances in .NET 6 but still needs work

Supporting display DPI awareness and sharing display configuration information between the Windows Forms runtime and designer have been challenging, Microsoft said.

Windows Forms advances in .NET 6 but still needs work
Frank Peters / Getty Images

The runtime for Windows Forms, Microsoft’s UI framework for building Windows desktop applications, was spruced up with the recent release of .NET 6.0, although high-DPI and scaling issues remain to be resolved for the application.

In a bulletin on Windows Forms improvements published November 16, Microsoft said it had been working through the “high DPI space” trying to get Windows Forms applications to properly support PerMonitorV2 mode, a DPI awareness mode that allows applications to immediately render correctly whenever the DPI changes.

PerMonitorV2 support has been a challenging undertaking and “sadly, we couldn’t achieve as much as we hoped,” Igor Velikorossov, software engineer for Windows Forms at Microsoft, said. But progress has been made in the .NET 6 release, with support for creating controls in the same DPI awareness as the application, and correct scaling of ContainerControl and MDI child windows in PerMonitorV2 mode in most scenarios.

Microsoft cited a number of other changes for Windows Forms in .NET 6.0, which was released on November 8:

  • A more streamlined Windows Forms application bootstrap that allows sharing of configuration information between the runtime and the designer during  development.
  • Also for application bootstrapping, Visual Basic in .NET 6.0 intruduces a new application event, ApplyApplicationDefaults, to define application-wide settings in the typical Visual Basic way. Also, designer support for the default font configured via MSBuild properties is coming in the near future.
  • Templates have been updated for C# to support global using directives, file-scoped namespaces, and nullable reference types.
  • For accessibility, there is improved support for assistive technology.
  • Porting has been completed for missing designers and designer-related infrastructure to enable building a general purpose designer.
  • New overloads have been implemented for Control.Invoke() and Control.BeginInvoke() methods that take Action and Func<T> and allow writing of more modern and more concise code.

Copyright © 2021 IDG Communications, Inc.