165
143 shares, 165 points


Microsoft’s oldest .NET desktop framework, Windows Forms, has been improved for .NET 6, although full help for top decision shows is “a challenging undertaking,” in response to software program engineer Igor Velikorossov.

The first launch of Windows Forms was in February 2002, when it was positioned because the successor to Visual Basic 6.0 (1998) as a speedy software growth framework for Windows desktop functions. There was enormous friction in that transition, but it surely was nonetheless fashionable and straightforward to make use of. Underneath Windows Forms lies the Win32 API and the GDI+ graphics API.

In late 2006, Microsoft launched Windows Vista and together with it a brand new .NET desktop framework known as Windows Presentation Foundation (WPF). Unlike Windows Forms, it used DirectX to render graphics, enabling richer designs with {hardware} accelerated efficiency.

WPF was additionally designed to scale properly regardless of the show decision and Windows show settings, thanks to make use of of structure managers for positioning consumer interface components.

Windows Forms in Visual Studio 2022

Windows Forms in Visual Studio 2022

Why is Microsoft nonetheless investing in Windows Forms, the oldest .NET desktop framework, when it has been changed a number of instances, first by WPF, then by Windows 8 with its Windows Runtime APIs, then by UWP (Universal Windows Platform), and most just lately by WinUI 3 (also referred to as Project Reunion)? The reply is solely the recognition of the framework and the variety of legacy enterprise functions that use it. Third-party element distributors additionally gave good help to the platform.

It appears that regardless of the technical superiority of WPF, many enterprise builders discover Windows Forms simpler, maybe due to its apparently easy type designer the place a button or checkbox stays the place it’s positioned, a minimum of till customers with totally different show settings complain about overlapping textual content or chopped-off characters.

Windows Forms is just for Windows and never a lot was performed to it for some years, particularly because it was for .NET Framework and most growth effort was going into the open supply .NET Core. That modified when .NET Core 3.0 was launched, with help for each Windows Forms and WPF. At this level each frameworks grew to become open supply, although this was a fork and Velikorossov’s submit about what’s new in Windows Forms considerations the .NET 6.0 model, not the .NET Framework one.

Migration of an current software is not easy and could also be unattainable with out main surgical procedure.

Some options of .NET Framework, embrace Application Domains, .NET Remoting, Windows Workflow Foundation, and Windows Communication Foundation (WCF), with WCF being essentially the most problematic.

Remote communication utilizing SOAP (an XML remoting commonplace) and WCF was broadly used, typically with ASP.NET on the net server and a Windows Forms consumer.

Despite these points, Microsoft has added options together with accessibility enhancements – corresponding to higher display screen narrator help and consumer interface automation – up to date templates to help the brand new .NET 6.0 world utilizing directive, and new runtime designers. “In .NET Core 3.0 we started to modernize and rejuvenate Windows Forms,” mentioned Velikorossov.

The largest problem stays scaling and excessive DPI (dots per inch) shows. The unique scaling methodology for Windows Forms was based mostly on the default system font, on whose dimension all of the autoscaling of a type depended. It was not an excellent system. There had been rounding errors, points with consumer controls and with type inheritance, and “forms and their child controls could only be concurrently designed by multiple developers if their machine resolutions were the same,” say the docs.

There had been tweaks, however excessive DPI help didn’t arrive till .NET Framework 4.7 and solely labored on Windows 10 Creators Update and later. When the .NET Core model got here alongside, Velikorossov describes how the crew modified the default font and “quickly learned that a great number of things depended on this default font metrics.”

The purpose of full help for per-monitor V2 DPI consciousness stays, that means that functions are by no means bitmap scaled by Windows (inflicting fuzzy fonts) however are notified when DPI modifications, possibly due to a setting change or a window being dragged to a different show. “It is a challenging undertaking, and sadly we couldn’t achieve as much as we’d hoped,” mentioned Velikorossov, however there are enhancements with right scaling of container controls and MDI little one home windows “in most scenarios.”

There are additionally group contributions to Windows Forms for .NET 6.0 together with MessageBox, used for fast dialogs requiring consumer affirmation or enter, optionally getting two new buttons: Try Again, and Continue.

Developers reacted to Velikorossov’s submit with some requests. “Please add native dark mode,” was one, although apparently a problem right here is that “Windows still does not have a documented way to check whether the system is in light or dark mode.” Another commented gratefully that the “Form Designer in release VS 2022 works much better, it was way too slow.”

When the .NET Foundation performed a developer survey earlier this yr, WPF and Windows Forms got here out as extra broadly used than Microsoft’s more moderen efforts.

It is just not a good selection for a GUI software immediately, being Windows-only and a weak possibility even on Windows, but legacy mixed with its preliminary ease of use means it will likely be round for a few years to return, one thing builders are much less positive about with another .NET applied sciences. ®


Like it? Share with your friends!

165
143 shares, 165 points

What's Your Reaction?

confused confused
0
confused
lol lol
0
lol
hate hate
0
hate
fail fail
0
fail
fun fun
0
fun
geeky geeky
0
geeky
love love
0
love
omg omg
0
omg
win win
0
win