Windows Forms (WinForms) is a graphical (GUI) class library included as a part of Microsoft .NET Framework, providing a platform to write rich client applications for desktop, laptop, and tablet PCs. While it is seen as a replacement for the earlier and more complex C++ based Microsoft Foundation Class Library, it does not offer a comparable paradigm and only acts as a platform for the user interface tier in a multi-tier solution.
Video Windows Forms
XAML Backwards Compatibility with WinForms
For future development, Microsoft has succeeded WinForms with XAML based GUI entry using Frameworks such as WPF and UWP. However, drag and drop placement of GUI components in a manner similar to WinForms is still provided in XAML by replacing the root XAML element of the Page/Window with a "Canvas" UI-Control. When making this change, the user can build a window in a similar fashion as in WinForms by directly dragging and dropping components using the Visual Studio GUI.
While XAML provided drag and drop placement backwards compatibility through the Canvas Control, XAML Controls are only similar to WinForm Controls and are not 1-to-1 backwards compatible. They perform similar functions and have a similar appearance, but the properties and methods are different enough to require remapping from one API to another.
Maps Windows Forms
Architecture
A Windows Forms application is an event-driven application supported by Microsoft's .NET Framework. Unlike a batch program, it spends most of its time simply waiting for the user to do something, such as fill in a text box or click a button.
Windows Forms provides access to native Windows User Interface Common Controls by wrapping the existent Windows API in managed code. With the help of Windows Forms, the .NET Framework provides a more comprehensive abstraction above the Win32 API than Visual Basic or MFC did.
Features
All visual elements in the Windows Forms class library derive from the Control class. This provides a minimal functionality of a user interface element such as location, size, color, font, text, as well as common events like click and drag/drop. The Control class also has docking support to let a control rearrange its position under its parent. The Microsoft Active Accessibility support in the Control class also helps impaired users to use Windows Forms better.
Besides providing access to native Windows controls like button, textbox, checkbox and listview, Windows Forms added its own controls for ActiveX hosting, layout arrangement, validation and rich data binding. Those controls are rendered using GDI+.
History and future
Just like Abstract Window Toolkit (AWT), the equivalent Java API, Windows Forms was an early and easy way to provide graphical user interface components to the .NET Framework. Windows Forms is built on the existing Windows API and some controls merely wrap underlying Windows components. Some of the methods allow direct access to Win32 callbacks, which are not available in non-Windows platforms.
In .NET Framework 2.0, Windows Forms gained richer layout controls, Office 2003 style toolstrip controls, multithreading component, richer design-time and data binding support as well as ClickOnce for web-based deployment.
With the release of .NET 3.0, Microsoft released a second, parallel API for rendering GUIs: Windows Presentation Foundation (WPF) based on DirectX, together with a GUI declarative language called XAML.
During a question-and-answer session at the Build 2014 Conference, Microsoft explained that Windows Forms was under maintenance mode, with no new features being added, but bugs found would still be fixed. Most recently, improved high-DPI support for various Windows Forms controls was introduced in updates to .NET Framework version 4.5.
Alternative implementation
Mono is a project led by Xamarin (formerly by Ximian, then Novell) to create an Ecma standard compliant .NET compatible set of tools.
Mono's support for System.Windows.Forms as of .NET 2.0 is announced as complete; also System.Windows.Forms 2.0 works natively on Mac OS X. However, System.Windows.Forms is not actively developed on Mono, and full compatibility with .NET is not achieved and is not possible, because Microsoft's System.Windows Forms is mainly a wrapper around the Windows API, and some of the methods allow direct access to Win32 callbacks, which are not available in platforms other than Windows.
See also
- Microsoft Visual Studio
- ClickOnce
- Abstract Window Toolkit (AWT), the equivalent GUI application programming interface (API) for the Java programming language
- Visual Component Library (VCL) from Borland
- Visual Test, test automation
References
External links
- MSDN: Building Windows Forms applications
- MSDN : Windows.Forms reference documentation
- MSDN : Windows Forms Technical Articles - Automating Windows Form with Visual Test
Source of article : Wikipedia