Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Windows Forms
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{distinguish|Microsoft Forms}} {{update|date=January 2023}} {{short description|Graphical user interface software library}} {{Infobox software | name = Windows Forms (WinForms) | screenshot = Screenshot of WinForms Designer as seen in Visual Studio 2019.png | logo = WinForms Logo.png | screenshot alt = Screenshot of Windows Forms designer as seen in [[Visual Studio 2019]]. | author = [[.NET Framework|.NET]]: [[Microsoft]],<br />[[Mono Framework|Mono]]: [[Ximian]]/[[Novell]] | other_names = WinForms | developer = [[.NET Foundation]] | released = {{Start date and age|2002|02|13}} | latest release version = v8.0.0 | latest release date = {{Start date and age|2023|11|14}}<ref>{{cite web|url=https://github.com/dotnet/winforms/releases/tag/v8.0.0|title=v8.0.0|date=2023-11-14|website=github.com|access-date=2023-11-21}}</ref> | latest preview version = | latest preview date = | programming language = [[C Sharp (programming language)|C#]] | operating system = [[Microsoft Windows]] | platform = [[.NET Framework]], [[.NET]], [[Mono (software)|Mono]] | genre = [[Software framework]], [[widget toolkit]] | license = [[MIT License]] | website = {{URL|https://learn.microsoft.com/en-us/dotnet/desktop/winforms/}} }} '''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]] [[.NET]], [[.NET Framework]] or [[Mono (software)|Mono]],<ref>{{cite book|title=Windows Forms Programming in C#|last=Sells|first=Chris|publisher=Addison-Wesley Professional|edition=1st|date=September 6, 2003|page=xxxviiii}}</ref> providing a platform to write client applications for desktop, laptop, and tablet PCs.<ref>{{cite web|url=https://msdn.microsoft.com/en-us/library/ff647339.aspx|title=Design and Implementation Guidelines for Web Clients by Microsoft Pattern and Practices|publisher=Microsoft|date=November 2003}}</ref> 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<ref>{{cite book|chapter=Appendix B|title=Moving from MFC, Windows Forms 2.0 Programming|last1=Sells|first1=Chris|last2=Weinhardt|first2=Michael|publisher=Addison-Wesley Professional|edition=2nd|date=May 16, 2006}}</ref> and only acts as a platform for the user interface tier in a [[Multitier architecture|multi-tier]] solution.<ref>{{cite web|title=Introduction to Windows Forms|type=Visual Studio 2003 documentation|publisher=Microsoft 2003|url=https://msdn.microsoft.com/en-us/library/aa983655(v=vs.71).aspx}}</ref> At the [[Microsoft Connect]] event on December 4, 2018, [[Microsoft]] announced releasing Windows Forms as an open source project on [[GitHub]]. It is released under the [[MIT License]]. 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 Framework|Mono's]] incomplete implementation of Windows Forms remains the only cross-platform implementation.<ref name="OpenSourcingGuiMartin">{{cite web |url=https://www.infoq.com/news/2018/12/msft-open-source-wpf-winforms | title=Microsoft Open Sources WPF, WinForms, and WinUI | last=Martin | first=Jeff | work=InfoQ | date=4 December 2018|access-date=2018-12-06 }}</ref><ref name="OpenSourcingGuiHanselman">{{cite web |url=https://www.hanselman.com/blog/AnnouncingWPFWinFormsAndWinUIAreGoingOpenSource.aspx | title=Announcing WPF, WinForms, and WinUI are going Open Source | last=Hanselman | first=Scott | date=4 December 2018|access-date=2018-12-06 }}</ref> == Architecture == [[File:DotNet3.0.svg|thumb|right|300px|This [[application programming interface|API]] is a part of [[.NET Framework]] 3.0]] A ''Windows Forms application'' is an [[event-driven programming|event-driven application]] supported by Microsoft's [[.NET Framework]]. Unlike a [[batch processing|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 (computing)|button]]. The code for the application can be written in a .NET programming language such as [[C Sharp (programming language)|C#]] or [[Visual Basic .NET|Visual Basic]]. Windows Forms provides access to native [[Windows USER|Windows User Interface]] Common Controls by wrapping the existent [[Windows API]] in [[managed code]].<ref>{{cite book|url=http://www.informit.com/articles/article.aspx?p=2048355&seqNum=4|title=C# 4.0 Unleashed|last=De Smet|first=Bart|publisher=Sams Publishing|date=January 4, 2011|chapter=Chapter 5}}</ref> With the help of Windows Forms, the .NET Framework provides a more comprehensive abstraction above the Win32 API than Visual Basic or MFC did.<ref>{{cite book|title=NET Windows Forms in a Nutshell|last1=Griffiths|first1=Ian|last2=Adams|first2=Matthew|publisher=O'Reilly Media|date=March 2003|page=4}}</ref> Windows Forms is similar to [[Microsoft Foundation Class Library|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.<ref name="Griffiths2003">{{cite book|title=NET Windows Forms in a Nutshell|last1=Griffiths|first1=Ian|last2=Adams|first2=Matthew|publisher=O'Reilly Media|date=March 2003|pages=27β53}}</ref> 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 [[Attribute (computing)|attributes]] and [[Event handler|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]] hosting, layout arrangement, validation and rich data binding. Those controls are rendered using [[Graphics Device Interface|GDI]]+.<ref name="Griffiths2003"/> == History and future == Just like [[Abstract Window Toolkit]] (AWT), the equivalent [[Java (programming language)|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.<ref name="monofaq-winform">{{cite web | url=http://www.mono-project.com/FAQ:_Winforms | title= FAQ: Winforms | publisher=mono-project.com | quote= ''It is very unlikely that the implementation will ever implement everything needed for full compatibility with Windows.Forms. The reason is that Windows.Forms is not a complete toolkit, and to work around this problem some of the underlying Win32 foundation is exposed to the programmer in the form of exposing the Windows message handler''}}</ref> Some of the methods allow direct access to Win32 [[Callback (computer programming)|callbacks]], which are not available in non-Windows platforms.<ref name="monofaq-winform"/> 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.<ref>{{cite book|chapter=Appendix A. What s New in Windows Forms 2.0|title=Windows Forms 2.0 Programming|last1=Sells|first1=Chris|last2=Weinhardt|first2=Michael|publisher=Addison-Wesley Professional|edition=2nd|date=May 16, 2006}}</ref><ref>{{cite book|title=Data Binding with Windows Forms 2.0: Programming Smart Client Data Applications with .NET|url=https://archive.org/details/databindingwithw0000noye|url-access=registration|last=Noyes|first=Brian|publisher=Addison-Wesley Professional|edition=1st|date=January 12, 2006|chapter=Preface|isbn=978-81-317-4823-7 }}</ref> With the release of .NET Framework 3.0, Microsoft released a second, parallel API for rendering GUIs: [[Windows Presentation Foundation]] (WPF) based on DirectX,<ref>{{cite book|section=DirectX, not GDI+|title=Pro WPF and Silverlight MVVM: Effective Application Development with Model|last=Hall|first=Gary|publisher=Apress|edition=2010|date=December 27, 2010|page=2}}</ref> together with a GUI declarative language called [[Extensible Application Markup Language|XAML]].<ref>{{cite web | access-date = 2011-08-25 | last = Smith | first = Josh | date = 2007-09-05 | publisher = Josh Smith on WPF | title = WPF vs. Windows Forms | quote = WPF is not intended to replace Windows Forms. [...] Windows Forms is still alive and well, and will continue to be enhanced and supported by Microsoft for years to come. WPF is simply another tool for Windows desktop application developers to use, when appropriate. | url = https://joshsmithonwpf.wordpress.com/2007/09/05/wpf-vs-windows-forms/}}</ref> <!--Since WPF is relatively new, it is unclear if Windows Forms will continue to be improved in future .NET releases.<ref>{{cite web | url=http://joshsmithonwpf.wordpress.com/2007/09/05/wpf-vs-windows-forms/ | title= WPF vs. Windows Forms | first=Josh|last=Smith | date=2007-09-05 | access-date=2008-07-26}}</ref><ref>{{cite web | url=http://blogs.msdn.com/mharsh/archive/2004/09/20/231888.aspx | title= WPF vs. Windows Forms | first=Mike|last=Harsh | quote=''If youβre targeting only Windows XP and Longhorn, Avalon is the way to go. But Windows Forms is still the only way to write managed UI that will run on Win 2K and below'' | date=2004-09-20 | access-date=2008-07-26}}</ref><ref>{{cite web | url=http://www.longhorncorner.com/Blogs/BlogDetail.aspx?BlogId=660 | title= Future of Windows Forms and ASP.NET | first=Mahesh|last=Chand | date=2008-05-08 | access-date=2008-07-26}}</ref>--> During a question-and-answer session at the [[Build (developer conference)|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.<ref>{{cite web | url=http://www.infoq.com/news/2014/04/WPF-QA | title=A WPF Q&A | publisher=infoq.com | date=2014-04-03 | quote=''Windows Forms is continuing to be supported, but in maintenance mode. They will fix bugs as they are discovered, but new functionality is off the table'' | access-date=2014-04-21}}</ref> Most recently, improved high-DPI support for various Windows Forms controls was introduced in updates to .NET Framework version 4.5.<ref>{{Cite web|url = http://www.infoq.com/news/2014/05/DotNet-4-5-2|title = High DPI Improvements for Windows Forms in .NET 4.5.2|date = 2014-05-06|access-date = 2015-02-10|website = InfoQ|last = Allen|first = Jonathan}}</ref> ==XAML backwards compatibility with Windows Forms== For future development, Microsoft has succeeded Windows Forms with a [[XAML]]-based GUI entry using frameworks such as [[Windows Presentation Foundation|WPF]] and [[Universal Windows Platform|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 (software)|Mono]] is a project led by [[Xamarin]] (formerly by [[Ximian]], then [[Novell]]) to create an [[Ecma International|Ecma]] standard compliant [[.NET Framework]] compatible set of tools. In 2011, [[Mono (software)|Mono]]'s support for System.Windows.Forms as of [[.NET Framework version history#.NET Framework 2.0|.NET 2.0]] was announced as complete;<ref>{{cite web | url=http://www.mono-project.com/WinForms | title= WinForms | publisher=mono-project.com | quote=''Support for Windows Forms 2.0 is complete. At this point, we are largely just fixing bugs and polishing our code. '' | access-date=2011-07-30}}</ref> System.Windows.Forms 2.0 works natively on Mac OS X.<ref>{{cite web | url=http://www.mono-project.com/FAQ:_Winforms | title= WinForms | publisher=mono-project.com | quote=''Does Winforms run on OSX? Yes, as of Mono 1.9, Winforms has a native OSX driver that it uses by default'' | access-date=2011-07-30}}</ref> However, System.Windows.Forms has not been actively developed on Mono.<ref>{{cite web |url=http://tirania.org/blog/archive/2011/Mar-07.html | title=GDC 2011 | last=de Icaza | first=Miguel | author-link=Miguel de Icaza |date=2011-03-07 |access-date=2011-07-30 |quote=''For tools that are mostly OpenGL/DirectX based, use Windows.Forms, keeping in mind that some bug fixing or work around on their part might be needed as our Windows.Forms is not actively developed.''}}</ref> Full compatibility with .NET was 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 [[Callback (computer programming)|callbacks]], which are not available in platforms other than Windows.<ref name="monofaq-winform"/> A more significant problem is that, since version 5.2,<ref>{{cite web |url=https://www.mono-project.com/docs/about-mono/supported-platforms/macos/ | title=Introduction to Mono on macOS | publisher=mono-project.com | access-date=2019-11-12 }}</ref> 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 (API)|Carbon]].<ref>{{cite web |url=https://www.infoq.com/news/2018/02/mono-forms-carbon64/ | title=Windows.Forms Comes to 64-bit Mac OS X | last=Martin | first=Jess | access-date=2019-11-12 }}</ref> As of this date{{when|date=January 2021}}, 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 == {{Portal|Free and open-source software}} * [[Microsoft Visual Studio]] * [[ClickOnce]] * [[Abstract Window Toolkit]] (AWT), the equivalent [[graphical user interface|GUI]] [[application programming interface]] (API) for the [[Java (programming language)|Java]] programming language * [[Visual Component Library]] (VCL) from Borland * [[Visual Test]], test automation == References == {{Reflist|2}} == External links == {{Wikibooks|.NET Development Foundation}} <!--===========================({{NoMoreLinks}})=============================== | PLEASE BE CAUTIOUS IN ADDING MORE LINKS TO THIS ARTICLE. WIKIPEDIA IS | | NOT A COLLECTION OF LINKS NOR SHOULD IT BE USED FOR ADVERTISING. | | | | Excessive or inappropriate links WILL BE DELETED. | | See [[Wikipedia:External links]] and [[Wikipedia:Spam]] for details. | | | | If there are already plentiful links, please propose additions or | | replacements on this article's discussion page. Or submit your link | | to the appropriate category at the Open Directory Project (www.dmoz.org)| | and link back to that category using the {{dmoz}} template. | ===========================({{NoMoreLinks}})===============================--> * [http://www.microsoft.com/events/series/windowsforms.mspx MSDN: Building Windows Forms applications] * [https://msdn.microsoft.com/en-us/library/dd30h2yb.aspx MSDN : Windows.Forms reference documentation] * [https://msdn.microsoft.com/en-us/library/ms996405.aspx MSDN : Windows Forms Technical Articles - Automating Windows Form with Visual Test] {{.NET Framework}} {{Microsoft APIs}} {{Microsoft FOSS}} {{Widget toolkits}} [[Category:.NET terminology]] [[Category:2002 software]] [[Category:Formerly proprietary software]] [[Category:Free and open-source software]] [[Category:Microsoft application programming interfaces|Forms]] [[Category:Microsoft free software]] [[Category:Mono (software)]] [[Category:Software using the MIT license]] [[Category:Widget toolkits]] [[Category:Windows-only free software]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:.NET Framework
(
edit
)
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Distinguish
(
edit
)
Template:Infobox software
(
edit
)
Template:Microsoft APIs
(
edit
)
Template:Microsoft FOSS
(
edit
)
Template:Portal
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Update
(
edit
)
Template:When
(
edit
)
Template:Widget toolkits
(
edit
)
Template:Wikibooks
(
edit
)