Windows Forms APIs

Reference documentation for the .NET Windows Forms framework.

Windows Forms API Reference

Windows Forms is a UI framework for building rich desktop applications for Windows. This section provides detailed API documentation for the classes, interfaces, enumerations, and other types that make up the Windows Forms framework.

System.Windows.Forms Namespace

This is the primary namespace for Windows Forms. It contains classes for creating controls, forms, menus, dialogs, and handling user input.

Type Description
System.Windows.Forms.Form Represents a window, which is a separate control that displays a title bar, border, and (depending on the style) can be minimized, maximized, and closed.
System.Windows.Forms.Control Represents the base class for all controls in a Windows Forms application.
System.Windows.Forms.Button Represents a standard Windows button control.
System.Windows.Forms.TextBox Represents a Windows text box control.
System.Windows.Forms.Label Represents a Windows label control.
System.Windows.Forms.DataGridView Represents a Windows Forms control that displays data in a table format.
System.Windows.Forms.MessageBox Displays a message box, which is a dialog box that presents a message to the user and waits for the user to respond.

System.Drawing Namespace

Provides fundamental types used for graphics operations, such as colors, points, rectangles, and images.

Type Description
System.Drawing.Color Represents an RGBA color.
System.Drawing.Point Represents an ordered pair of integers that specifies a location in two-dimensional space.
System.Drawing.Rectangle Represents a rectangle defined by a location, width, and height.
System.Drawing.Bitmap Represents an object that is a portion of a surface of the most commonly used type of bitmap.

System.ComponentModel Namespace

Contains types that enable runtime and design-time support for components and controls. This includes attributes, events, and type converters.

Type Description
System.ComponentModel.EventHandler Represents the method that will handle an event.
System.ComponentModel.BrowsableAttribute Specifies whether to show a property or event in the Properties window at design time.
System.ComponentModel.DisplayNameAttribute Specifies the display name for a property, event, or member.

System.Windows.Forms.DataVisualization Namespace

Contains classes for creating charts and graphs within Windows Forms applications.

Type Description
System.Windows.Forms.DataVisualization.Charting.Chart Represents a Windows Forms control that displays chart data.
System.Windows.Forms.DataVisualization.Charting.Series Represents a collection of data points that are plotted as a single series on a chart.

Microsoft.VisualBasic.Compatibility.VB6.WinForms Namespace

Provides classes to help migrate Visual Basic 6.0 Windows Forms applications to Visual Basic .NET.

Type Description
Microsoft.VisualBasic.Compatibility.VB6.WinForms.AxHost Provides functionality to host ActiveX controls in .NET Windows Forms.

Getting Started

To start building Windows Forms applications, you typically create a new project in Visual Studio. You can then drag and drop controls from the Toolbox onto your form designer and write code in C# or Visual Basic to handle events and implement application logic.

Common Tasks:

  • Creating a new Form.
  • Adding controls like Buttons, TextBoxes, and Labels.
  • Handling user interactions (e.g., Button clicks).
  • Binding data to controls like DataGridView.
  • Customizing control appearance and behavior.

Resources