Windows Forms, the oldest .Net framework for desktops, has been improved again for .Net 6.0. Windows Forms were first released in February 2002 as a successor of Visual Basic 6.0. It came as a fast application development framework. Since then, it has been changed many times, first by the WPF, followed by Windows 8 , then by UWP, and recently by WinUI 3. Then why is Microsoft investing still in Windows Forms?
The simple answer to this question is mainly because of this framework’s popularity. Moreover, there are many legacy business applications using it. Various third-party component service providers also gave their support to this platform. Businesses find these Forms simpler, due to its simple for designer. So, let’s delve deep and find out what is new in Windows Forms in .Net 6.0:
1. Accessibility Fixes and Improvements
Windows Forms applications have now become more accessible to users. Some of the improvements when it comes to their accessibility include:
- Enhanced support for helpful technologies. UIA providers allow tools such as Narrator to interact with an application’s elements. There is support for UIA providers for the controls including, TrackBar, Tabcontrol, CheckedListBox, ScrollBar, Panel, and LinkLabel.
- Corrected control type for better Text Cntrol Patterns support.
- Keyboard tooltips for TreeView’s TreeNote control and Tabcontrol’s TabPage.
- Enhanced Narrator announcements in ErrorPRovider, ListView, and DataGridView column header controls.
- Enhanced color contrast for the controls including Label, ToolCtripButton, ProprtyGridView, DataGridView, and CheckedListBox.
- Invoke Control Patterns support for UpDownButtons components in NumericUpDown and DomainUpDown controls.
2. Scaling and High DPI Fixes
This was a challenging undertaking. The team of windows Forms worked hard to support PErMonitorV2 mode correctly and remarkably, but could not attain as much as they wanted. Still, they made some progress and now you can:
- Build controls in same DPI as the application.
- Scale MDI child Windows and ContainerControls in PErMonitorV2 mode.
3. Template Updates
C# templates have been updated according to related changes in the .Net workloads. For C#, The Windows Forms templates have been updates for supporting file-scoped namespaces, global using directives, and nullable reference type. Since a general windows forms application includes various types split for multiple files , and needs a STAThread attribute, top-class statements are absent from their template. The updated templates include application bootstrap code.
4. Application Bootstrap
With .Net Core 3, Windows Forms started modernizing and rejuvenating. In this, the default font was changed to Segoe UI and it was found that many things counted on the default font metrics. The designer, for example, was not WYSIWYG since Visual Studio procedure was run under the .Net framework 4.7.2. It used the older default font of Sans Sarif and the .Net applications used the new font. This made it difficult for clients to migrate large applications with perfect layouts. Though there were many migration strategies for clients, applying them across various controls and forms was a significant undertaking.
Hence, a new Windows Forms bootstrap was launched. Now the Visual Basic also handles application-wide default value differently. When it comes to .Net 6.0, it introduced a new, latest application event called Apply Application Defaults that let you outline application-wide settings in a general Visual Basic way. A designer support will also be available for default font configured through MSBuild properties.
Other Noteworthy Changes
- New API –IsAncestorSiteInDesignerMode is complementary to the Component.DesignerMode.
- New Overloads for the Control.BEginInvoke () and Control.Invoke () methods that take Func<T> and Action and let you write more concise and modern codes.
- Windows 11 styled default tooltips behaviour makes these tooltips stay open whenever you hover the mouse over it and they don’t disappear automatically. These tooltips can be dismissed using Escape or Control keys.
So, this was all about the latest changes that come with Windows Forms in .Net 6.0. If you are one of those businesses who like to use Windows Forms, you can contact and hire dot net developer today from a reputed nearshore software development company who can help you make the most from these forms.