Printer Friendly Version      Send     
Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
Previous Versions
.NET Framework 1.1
.NET Framework
Reference
This page is specific to
Microsoft Visual Studio 2003/.NET Framework 1.1

Other versions are also available for the following:
.NET Framework Class Library
System.Windows.Forms Namespace

The System.Windows.Forms namespace contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system.

The classes in this namespace can be grouped into the following categories:

  • Control, User Control, and Form. Most classes within the System.Windows.Forms namespace derive from the Control class. The Control class provides the base functionality for all controls that are displayed on a Form. The Form class represents a window within an application. This includes dialog boxes, modeless windows, and Multiple Document Interface (MDI) client and parent windows. To create a custom control that is a composite of other controls, use the UserControl class.
  • Controls. The System.Windows.Forms namespace provides a variety of control classes that allow you to create rich user interfaces. Some controls are designed for data entry within the application, such as TextBox and ComboBox controls. Other controls display application data, such as Label and ListView. The namespace also provides controls for invoking commands within the application, such as Button and ToolBar. In addition, the PropertyGrid control can be used to create your own Windows Forms designer that displays the designer-visible properties of the controls.
  • Components. In addition to controls, the System.Windows.Forms namespace provides other classes that do not derive from the Control class but still provide visual features to a Windows-based application. Some classes, such as ToolTip and ErrorProvider, extend the capabilities or provide information to the user. Other classes, such as Menu, MenuItem, and ContextMenu, provide the ability display menus to the user to invoke commands within an application. The Help and HelpProvider classes enable you to display help information to the user of your applications.
  • Common Dialog Boxes. Windows provides a number of common dialog boxes that can be used to give your application a consistent user interface when performing tasks such as opening and saving files, manipulating the font or text color, or printing. The OpenFileDialog and SaveFileDialog classes provide the functionality to display a dialog box that allows the user to browse to and enter the name of a file to open or save. The FontDialog class displays a dialog box to change elements of the Font object used by your application. The PageSetupDialog, PrintPreviewDialog, and PrintDialog classes display dialog boxes that allow the user to control aspects of printing documents. For more information on printing from a Windows-based application, see the System.Drawing.Printing namespace. In addition to the common dialog boxes, the System.Windows.Forms namespace provides the MessageBox class for displaying a message box that can display and retrieve data from the user.

There are a number of classes within the System.Windows.Forms namespace that provide support to the classes mentioned in the preceding summary. Example of the supporting classes are enumerations, event argument classes, and delegates used by events within controls and components.

Note   To make your Windows Forms application support Windows XP visual styles, be sure to set the FlatStyle property of your controls to FlatStyle.System and include a manifest with your executable. A manifest is an XML file that is included either as a resource within your application executable or as a seperate file that resides in the same directory as the executable file. For an example of a manifest, see the Example section for the FlatStyle enumeration. For more information about using the visual styles available in Windows XP, see the Using Windows XP Visual Styles in the User Interface Design and Development section of the MSDN Library.

Namespace hierarchy

Classes

Class Description
AccessibleObject Provides information that accessibility applications use to adjust an application's UI for users with impairments.
AmbientProperties Provides ambient property values to top-level controls.
Application Provides static (Shared in Visual Basic) methods and properties to manage an application, such as methods to start and stop an application, to process Windows messages, and properties to get information about an application. This class cannot be inherited.
ApplicationContext Specifies the contextual information about an application thread.
AxHost Wraps ActiveX controls and exposes them as fully featured Windows Forms controls.
AxHost.InvalidActiveXStateException The exception that is thrown when the ActiveX control is referenced while in an invalid state.
AxHost.State Encapsulates the persisted state of an ActiveX control.
BaseCollection Provides the base functionality for creating data-related collections in the System.Windows.Forms namespace.
Binding Represents the simple binding between the property value of an object and the property value of a control.
BindingContext Manages the collection of BindingManagerBase objects for any object that inherits from the Control class.
BindingManagerBase Manages all Binding objects that are bound to the same data source and data member. This class is abstract.
BindingsCollection Represents a collection of Binding objects for a control.
Button Represents a Windows button control.
ButtonBase Implements the basic functionality common to button controls.
CheckBox Represents a Windows check box.
CheckedListBox Displays a ListBox in which a check box is displayed to the left of each item.
CheckedListBox.
CheckedIndexCollection
Encapsulates the collection of indexes of checked items (including items in an indeterminate state) in a CheckedListBox.
CheckedListBox.
CheckedItemCollection
Encapsulates the collection of checked items (including items in an indeterminate state) in a CheckedListBox control.
CheckedListBox.ObjectCollection Represents the collection of items in a CheckedListBox.
Clipboard Provides methods to place data on and retrieve data from the system clipboard. This class cannot be inherited.
ColorDialog Represents a common dialog box that displays available colors along with controls that allow the user to define custom colors.
ColumnClickEventArgs Provides data for the ColumnClick event.
ColumnHeader Displays a single column header in a ListView control.
ComboBox Represents a Windows combo box control.
ComboBox.ObjectCollection Represents the collection of items in a ComboBox.
CommonDialog Specifies the base class used for displaying dialog boxes on the screen.
ContainerControl Provides focus management functionality for controls that can function as a container for other controls.
ContentsResizedEventArgs Provides data for the ContentsResized event.
ContextMenu Represents a shortcut menu.
Control Defines the base class for controls, which are components with visual representation.
Control.ControlAccessibleObject Provides information about a control that can be used by an accessibility application.
Control.ControlCollection Represents a collection of Control objects
ControlBindingsCollection Represents the collection of data bindings for a control.
ControlEventArgs Provides data for the ControlAdded and ControlRemoved events.
ControlPaint Provides methods used to paint common Windows controls and their elements.
ConvertEventArgs Provides data for the Format and Parse events.
CreateParams Encapsulates the information needed when creating a control.
CurrencyManager Manages a list of Binding objects.
Cursor Represents the image used to paint the mouse pointer.
CursorConverter Provides a type converter to convert Cursor objects to and from various other representations.
Cursors Provides a collection of Cursor objects for use by a Windows Forms application.
DataFormats Provides static (Shared in Visual Basic), predefined Clipboard format names. Use them to identify the format of data that you store in an IDataObject.
DataFormats.Format Represents a clipboard format type.
DataGrid Displays ADO.NET data in a scrollable grid.
DataGrid.HitTestInfo Contains information about a part of the System.Windows.Forms.DataGrid at a specified coordinate. This class cannot be inherited.
DataGridBoolColumn Specifies a column in which each cell contains a check box for representing a Boolean value.
DataGridColumnStyle Specifies the appearance and text formatting and behavior of a System.Windows.Forms.DataGrid control column. This class is abstract.
DataGridPreferredColumnWidthTypeConverter Converts the value of an object to a different data type.
DataGridTableStyle Represents the table drawn by the System.Windows.Forms.DataGrid control at run time.
DataGridTextBox Represents a TextBox control that is hosted in a DataGridTextBoxColumn.
DataGridTextBoxColumn Hosts a TextBox control in a cell of a DataGridColumnStyle for editing strings.
DataObject Implements a basic data transfer mechanism.
DateRangeEventArgs Provides data for the DateChanged or DateSelected events of the MonthCalendar control.
DateTimePicker Represents a Windows date/time picker control.
DomainUpDown Represents a Windows up-down control that displays string values.
DomainUpDown.
DomainUpDownItemCollection
Encapsulates a collection of objects for use by the DomainUpDown class.
DragEventArgs Provides data for the DragDrop, DragEnter, or DragOver event.
DrawItemEventArgs Provides data for the DrawItem event.
ErrorProvider Provides a user interface for indicating that a control on a form has an error associated with it.
FeatureSupport Provides static (Shared in Visual Basic) methods for retrieving feature information from the current system.
FileDialog Displays a dialog box from which the user can select a file.
FolderBrowserDialog Represents a common dialog box that allows the user to choose a folder. This class cannot be inherited.
FontDialog Represents a common dialog box that displays a list of fonts that are currently installed on the system.
Form Represents a window or dialog box that makes up an application's user interface.
Form.ControlCollection Represents a collection of controls on the form.
GiveFeedbackEventArgs Provides data for the GiveFeedback event, which occurs during a drag operation.
GridColumnStylesCollection Represents a collection of DataGridColumnStyle objects in the System.Windows.Forms.DataGrid control.
GridItem Implements one row in a PropertyGrid.
GridItemCollection Contains a collection of GridItem objects.
GridTableStylesCollection Represents a collection of DataGridTableStyle objects in the DataGrid control.
GroupBox Represents a Windows group box.
Help Encapsulates the HTML Help 1.0 engine.
HelpEventArgs Provides data for the HelpRequested event.
HelpProvider Provides pop-up or online Help for controls.
HScrollBar Represents a standard Windows horizontal scroll bar.
ImageIndexConverter Provides a type converter to convert data for an image index to and from a string.
ImageList Provides methods to manage a collection of Image objects. This class cannot be inherited.
ImageList.ImageCollection Encapsulates the collection of Image objects in an ImageList.
ImageListStreamer Provides the data portion of an ImageList.
InputLanguage Provides methods and fields to manage the input language. This class cannot be inherited.
InputLanguageChangedEventArgs Provides data for the InputLanguageChanged event.
InputLanguageChangingEventArgs Provides data for the InputLanguageChanging event.
InputLanguageCollection Stores InputLanguage objects.
InvalidateEventArgs Provides data for the Invalidated event.
ItemChangedEventArgs Provides data for the ItemChanged event.
ItemCheckEventArgs Provides data for the ItemCheck event of the CheckedListBox and ListView controls.
ItemDragEventArgs Provides data for the ItemDrag event of the ListView and TreeView controls.
KeyEventArgs Provides data for the KeyDown or KeyUp event.
KeyPressEventArgs Provides data for the KeyPress event.
KeysConverter Provides a TypeConverter to convert Keys objects to and from other representations.
Label Represents a standard Windows label.
LabelEditEventArgs Provides data for the LabelEdit event.
LayoutEventArgs Provides data for the Layout event.
LinkArea.LinkAreaConverter Provides a type converter to convert LinkArea.LinkAreaConverter objects to and from various other representations.
LinkClickedEventArgs Provides data for the LinkClicked event.
LinkLabel Represents a Windows label control that can display hyperlinks.
LinkLabel.Link Represents a link within a LinkLabel control.
LinkLabel.LinkCollection Represents the collection of links within a LinkLabel control.
LinkLabelLinkClickedEventArgs Provides data for the LinkClicked event.
ListBindingConverter Provides a type converter to convert Binding objects to and from various other representations.
ListBox Represents a Windows list box control.
ListBox.ObjectCollection Represents the collection of items in a ListBox.
ListBox.SelectedIndexCollection Represents the collection containing the indexes to the selected items in a ListBox.
ListBox.SelectedObjectCollection Represents the collection of selected items in the ListBox.
ListControl Provides a common implementation of members for the ListBox and ComboBox classes.
ListView Represents a Windows list view control, which displays a collection of items that can be displayed using one of four different views.
ListView.CheckedIndexCollection Represents the collection containing the indexes to the checked items in a list view control.
ListView.
CheckedListViewItemCollection
Represents the collection of checked items in a list view control.
ListView.ColumnHeaderCollection Represents the collection of column headers in a ListView control.
ListView.ListViewItemCollection Represents the collection of items in a ListView control.
ListView.SelectedIndexCollection Represents the collection containing the indexes to the selected items in a list view control.
ListView.
SelectedListViewItemCollection
Represents the collection of selected items in a list view control.
ListViewItem Represents an item in a ListView control.
ListViewItem.ListViewSubItem Represents a subitem of a ListViewItem.
ListViewItem.
ListViewSubItemCollection
Represents a collection of ListViewItem.ListViewSubItem objects stored in a ListViewItem.
ListViewItemConverter Provides a type converter to convert ListViewItem objects to and from various other representations.
MainMenu Represents the menu structure of a form.
MeasureItemEventArgs Provides data for the MeasureItem event of the ListBox, ComboBox, CheckedListBox, and MenuItem controls.
Menu Represents the base functionality for all menus.
Menu.MenuItemCollection Represents a collection of MenuItem objects.
MenuItem Represents an individual item that is displayed within a MainMenu or ContextMenu.
MessageBox Displays a message box that can contain text, buttons, and symbols that inform and instruct the user.
MonthCalendar Represents a standard Windows month calendar control.
MonthCalendar.HitTestInfo Contains information about an area of a MonthCalendar control. This class cannot be inherited.
MouseEventArgs Provides data for the MouseUp, MouseDown, and MouseMove events.
NativeWindow Provides a low-level encapsulation of a window handle and a window procedure.
NavigateEventArgs Provides data for the Navigate event.
NodeLabelEditEventArgs Provides data for the BeforeLabelEdit and AfterLabelEdit events.
NotifyIcon Specifies a component that creates an icon in the status area. This class cannot be inherited.
NumericUpDown Represents a Windows up-down control that displays numeric values.
OpacityConverter Provides a type converter to convert opacity values to and from a string.
OpenFileDialog Represents a common dialog box that displays the control that allows the user to open a file. This class cannot be inherited.
OSFeature Provides operating-system specific feature queries.
PageSetupDialog Represents a dialog box that allows users to manipulate page settings, including margins and paper orientation.
PaintEventArgs Provides data for the Paint event.
Panel Represents a Windows Panel control.
PictureBox Represents a Windows picture box control for displaying an image.
PrintControllerWithStatusDialog Controls how a document is printed.
PrintDialog Allows users to select a printer and choose which portions of the document to print.
PrintPreviewControl Represents the raw "preview" part of print previewing, without any dialog boxes or buttons. Most PrintPreviewControl objects are found on PrintPreviewDialog objects, but they do not have to be.
PrintPreviewDialog Represents a dialog box form that contains a PrintPreviewControl.
ProgressBar Represents a Windows progress bar control.
PropertyGrid Provides a user interface for browsing the properties of an object.
PropertyGrid.PropertyTabCollection Contains a collection of PropertyTab objects.
PropertyManager Maintains a Binding between an object's property and a data-bound control property.
PropertyTabChangedEventArgs Provides data for the PropertyTabChanged event of a PropertyGrid.
PropertyValueChangedEventArgs Provides data for the PropertyValueChanged event of a PropertyGrid.
QueryAccessibilityHelpEventArgs Provides data for the QueryAccessibilityHelp event.