Windows Forms ("WinForms" for short) is a GUI class library included with the .NET Framework. It is a sophisticated object-oriented wrapper around the Win32 API, allowing the development of Windows desktop and mobile applications that target the .NET Framework.
WinForms is primarily event-driven. An application consists of multiple forms (displayed as windows on the screen), which contain controls (labels, buttons, textboxes, lists, etc.) that the user interacts with directly. In response to user interaction, these controls raise events that can be handled by the program to perform tasks.
Like in Windows, everything in WinForms is a control, which is itself a type of window. The base Control class provides basic functionality, including properties for setting text, location, size, and color, as well as a common set of events that can be handled. All controls derive from the Control class, adding additional features. Some controls can host other controls, either for reusability (Form
, UserControl
) or layout (TableLayoutPanel
, FlowLayoutPanel
).
WinForms has been supported since the original version of the .NET Framework (v1.0), and is still available in modern versions (v4.5). However, it is no longer under active development, and no new features are being added. According to 9 Microsoft developers at the Build 2014 conference:
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.
The cross-platform, open-source Mono library provides a basic implementation of Windows Forms, supporting all of the features that Microsoft's implementation did as of .NET 2.0. However, WinForms is not actively developed on Mono and a complete implementation is considered impossible, given how inextricably linked the framework is with the native Windows API (which is unavailable in other platforms).
You can provide help for Forms and Controls in a Windows Forms Applications in different ways. You can show a pop-up help, open a CHM file or a URL. You can show context-sensitive help for Forms, Controls and dialogs.
You can setup a HelpProvider
component to provide context sensitive help for component. This way when the user press F1 key or Help button of form, you can automatically:
You can use Help
class in code, to provide these kinds of help:
You can handle HelpRequested
event of Control
objects or Form
to perform custom actions when the user press F1 or click on Help button of form.
You can setup the Form
to show Help button on title-bar. This way, if the user click on Help button, the cursor will change to a ?
cursor and after click on any point, any context-sensitive help associated with the control using HelpProvider
will be show.
You can provide help for MessageBox
, OpenFileDialog
, SaveDialog
and ColorDialog
using Help button of the components.
You can use ToolTip
component to display some help text when the user points at controls. A ToolTip
can be associated with any control.
Note
Using HelpProvider
and Help
class You can show compiled Help files (.chm) or HTML files in the HTML Help format. Compiled Help files provide a table of contents, an index, search capability, and keyword links in pages. Shortcuts work only in compiled Help files.
You can generate HTML Help 1.x files by using HTML Help Workshop. For more information about HTML Help, see "HTML Help Workshop" and other HTML Help topics at Microsoft HTML Help.
Controls are derived in exactly the same way as other classes. The only thing to be careful of is overriding events: it is usually advisable to make sure that you call the base event handler after your own. My own rule of thumb: if in doubt, call the base event.
See https://msdn.microsoft.com/en-us/library/ef2xyb33.aspx Databinding only works with properties, never with fields!