Content deleted Content added
mNo edit summary |
Artoria2e5 (talk | contribs) →Alternative implementation: libgdi+ |
||
(48 intermediate revisions by 32 users not shown) | |||
Line 1:
{{distinguish|Microsoft Forms}}
{{update|date=January 2023}}
{{short description|Graphical user interface software library}}
{{Infobox software
| name
| screenshot
| logo = WinForms Logo.png
| screenshot alt
| author
| developer = [[.NET Foundation]]▼
| other_names = WinForms
| latest release version = v5.0.0-rtm.20520.1▼
|
| 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
| operating system
| platform
| genre
| license
| website
}}
'''Windows Forms''',
At the [[Microsoft Connect]] event on December 4, 2018, [[Microsoft]] announced releasing Windows Forms as an open source project on [
== 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 [[
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>
Line 32 ⟶ 36:
== 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"/>
Line 42 ⟶ 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
|
| last = Smith
| first = Josh
Line 57 ⟶ 63:
| first=Josh|last=Smith
| date=2007-09-05
|
| url=http://blogs.msdn.com/mharsh/archive/2004/09/20/231888.aspx
| title= WPF vs. Windows Forms
Line 63 ⟶ 69:
| 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
|
| 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
|
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
Line 76 ⟶ 82:
| 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''
|
==XAML
For future development, Microsoft has succeeded
While XAML
== 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
| 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. ''
|
System.Windows.Forms 2.0 works natively on Mac OS X.<ref>{{cite web
| url=http://www.mono-project.com/FAQ:_Winforms
Line 97 ⟶ 101:
| 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''
|
However, System.Windows.Forms has not been actively developed on Mono.<ref>{{cite web
|url=http://tirania.org/blog/archive/2011/Mar-07.html
Line 103 ⟶ 107:
| last=de Icaza
| first=Miguel
|
|date=2011-03-07
|
|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/
| title=Introduction to Mono on macOS
| publisher=mono-project.com
|
}}</ref>
Mono has been upgraded so that its default is to assume a 64 bit platform.
Line 120 ⟶ 125:
| last=Martin
| first=Jess
|
}}</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 ==
Line 136 ⟶ 141:
== External links ==
{{Wikibooks|.NET Development Foundation}}
<!--===========================({{NoMoreLinks}})===============================
| PLEASE BE CAUTIOUS IN ADDING MORE LINKS TO THIS ARTICLE. WIKIPEDIA IS |
Line 157 ⟶ 163:
{{Widget toolkits}}
[[Category:.NET
[[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:
|