Windows Forms, also known as WinForms, is a free, open-source graphical user interface (GUI) class library for building Windows desktop applications, included as a part of
Microsoft
Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
.NET
The .NET platform (pronounced as "''dot net"'') is a free and open-source, managed code, managed computer software framework for Microsoft Windows, Windows, Linux, and macOS operating systems. The project is mainly developed by Microsoft emplo ...
,
.NET Framework or
Mono, providing a platform to write 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
Microsoft Foundation Class Library (MFC) is a C++ object-oriented library for developing desktop applications for Windows.
MFC was introduced by Microsoft in 1992 and quickly gained widespread use. While Microsoft has introduced alternative a ...
, it does not offer a comparable paradigm and only acts as a platform for the user interface tier in a
multi-tier solution.
At the
Microsoft Connect event on December 4, 2018,
Microsoft
Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
announced releasing Windows Forms as an open source project on
GitHub
GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
. It is released under the
MIT License
The MIT License is a permissive software license originating at the Massachusetts Institute of Technology (MIT) in the late 1980s. As a permissive license, it puts very few restrictions on reuse and therefore has high license compatibility.
Unl ...
. With this release, Windows Forms has become available for projects targeting the
.NET Core framework. However, the framework is still available only on the Windows platform, and
Mono's incomplete implementation of Windows Forms remains the only cross-platform implementation.
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
A button is a fastener that joins two pieces of fabric together by slipping through a loop or by sliding through a buttonhole.
In modern clothing and fashion design, buttons are commonly made of plastic but also may be made of metal, wood, or ...
. The code for the application can be written in a .NET programming language such as
C# or
Visual Basic Visual Basic is a name for a family of programming languages from Microsoft. It may refer to:
* Visual Basic (.NET), the current version of Visual Basic launched in 2002 which runs on .NET
* Visual Basic (classic), the original Visual Basic suppo ...
.
Windows Forms provides access to native
Windows User Interface Common Controls by wrapping the existent
Windows API
The Windows API, informally WinAPI, is the foundational application programming interface (API) that allows a computer program to access the features of the Microsoft Windows operating system in which the program is running. Programs can acces ...
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.
Windows Forms is similar to
Microsoft Foundation Class (MFC) library in developing client applications. It provides a wrapper consisting of a set of C++ classes for development of Windows applications. However, it does not provide a default application framework like the MFC. Every control in a Windows Forms application is a concrete instance of a class.
Features
All visual elements in the Windows Forms class library derive from the Control class. This provides the 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.
In Visual Studio, forms are created using
drag-and-drop techniques. A tool is used to place controls (e.g., text boxes, buttons, etc.) on the form (window). Controls have
attributes and
event handlers associated with them. Default values are provided when the control is created, but may be changed by the programmer. Many attribute values can be modified during run time based on user actions or changes in the environment, providing a dynamic application. For example, code can be inserted into the form resize event handler to reposition a control so that it remains centered on the form, expands to fill up the form, etc. By inserting code into the event handler for a keypress in a text box, the program can automatically translate the case of the text being entered, or even prevent certain characters from being inserted.
Besides providing access to native Windows controls like button, textbox, checkbox and listview, Windows Forms added its own controls for
ActiveX
ActiveX is a deprecated software framework created by Microsoft that adapts its earlier Component Object Model (COM) and Object Linking and Embedding (OLE) technologies for content downloaded from a network, particularly from the World Wide W ...
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
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
API, Windows Forms was an early and easy way to provide
graphical user interface
A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
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 Framework 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.
XAML backwards compatibility with Windows Forms
For future development, Microsoft has succeeded Windows Forms with a
XAML-based GUI entry using frameworks such as
WPF and
UWP. However, drag and drop placement of GUI components in a manner similar to Windows Forms 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 Windows Forms by directly dragging and dropping components using the Visual Studio GUI.
While XAML provides drag and drop placement backwards compatibility through the Canvas Control, XAML Controls are only similar to Windows Forms Controls and are not one-to-one 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.
Alternative implementation
Mono is a project led by
Xamarin (formerly by
Ximian, then
Novell
Novell, Inc. () was an American software and services company headquartered in Provo, Utah, that existed from 1980 until 2014. Its most significant product was the multi-platform network operating system known as NetWare. Novell technolog ...
) to create an
Ecma standard compliant
.NET Framework compatible set of tools. In 2011,
Mono's support for System.Windows.Forms as of
.NET 2.0 was announced as complete;
System.Windows.Forms 2.0 works natively on Mac OS X.
However, System.Windows.Forms has not been actively developed on Mono.
Full compatibility with .NET was not possible, because Microsoft's System.Windows Forms is mainly a wrapper around the
Windows API
The Windows API, informally WinAPI, is the foundational application programming interface (API) that allows a computer program to access the features of the Microsoft Windows operating system in which the program is running. Programs can acces ...
, and some of the methods allow direct access to Win32
callbacks, which are not available in platforms other than Windows.
Mono's WinForms implementation is based on Mono's libgdiplus, which implements
GDI+ on top of
Gtk
GTK (formerly GIMP ToolKit and GTK+) is a free software cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both Free software, free and ...
and
Pango.
A more significant problem is that, since version 5.2,
Mono has been upgraded so that its default is to assume a 64 bit platform.
However, System.Windows.Forms on Mono for the Macintosh OS X platform has been built using a 32 bit subsystem,
Carbon
Carbon () is a chemical element; it has chemical symbol, symbol C and atomic number 6. It is nonmetallic and tetravalence, tetravalent—meaning that its atoms are able to form up to four covalent bonds due to its valence shell exhibiting 4 ...
.
As of this date, a 64-bit version of System.Windows.Forms for use on Mac OS X remains unavailable and only .NET applications built for the 32 bit platform can be expected to execute.
See also
*
Microsoft Visual Studio
*
ClickOnce
*
Abstract Window Toolkit (AWT), the equivalent
GUI application programming interface
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
(API) for the
Java
Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
programming language
*
Visual Component Library
The Visual Component Library (VCL) is a visual component-based object-oriented framework for developing the user interface of Microsoft Windows applications. It is written in Object Pascal.
History
The VCL was developed by Borland for use i ...
(VCL) from Borland
*
Visual Test, test automation
References
External links
MSDN: Building Windows Forms applicationsMSDN : Windows.Forms reference documentationMSDN : Windows Forms Technical Articles - Automating Windows Form with Visual Test
{{Widget toolkits
.NET terminology
2002 software
Formerly proprietary software
Free and open-source software
Forms
Microsoft free software
Mono (software)
Software using the MIT license
Widget toolkits
Windows-only free software