Windows Forms: Difference between revisions

Content deleted Content added
Features: gui designer
 
(20 intermediate revisions by 16 users not shown)
Line 1:
{{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 = v5.0.17
| latest release date version = {{Start date and age|2022|05|11}}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://docslearn.microsoft.com/en-us/dotnet/frameworkdesktop/winforms/}}
}}
'''Windows Forms''', (also known as '''WinForms)''', is a [[free and, open-source]] [[graphical user interface|graphical]] (GUI) [[Library (computing)|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| archive-date=2018-12-06|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| archive-date=2018-12-06|access-date=2018-12-06 }}</ref>
 
== Architecture ==
Line 46 ⟶ 48:
| 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
Line 83 ⟶ 85:
 
==XAML backwards compatibility with Windows Forms==
For future development, Microsoft has succeeded Windows Forms with ana [[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
 
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
Line 111:
|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"/> Mono's WinForms implementation is based on Mono's libgdiplus, which implements [[GDI+]] on top of [[Gtk]] and [[Pango]].<ref>{{cite web |title=Mono / libgdiplus · GitLab |url=https://gitlab.winehq.org/mono/libgdiplus |website=GitLab |language=en}}</ref>
 
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/
Line 163 ⟶ 164:
 
[[Category:.NET terminology]]
[[Category:2002 software]]
[[Category:Formerly proprietary software]]
[[Category:Free and open-source software]]
Line 170 ⟶ 172:
[[Category:Software using the MIT license]]
[[Category:Widget toolkits]]
[[Category:2002 software]]
[[Category:Windows-only free software]]