Bagikan melalui


Windows Forms Controls by Function

Windows Forms offers controls and components that perform a number of functions. The following table lists the Windows Forms controls and components according to general function. In addition, where multiple controls exist that serve the same function, the recommended control is listed with a note regarding the control it superseded. In a separate subsequent table, the superseded controls are listed with their recommended replacements.

Note

The following tables do not list every control or component you can use in Windows Forms; for a more comprehensive list, see Controls to Use on Windows Forms

Function

Control

Description

Data display

DataGridView control

The DataGridView control provides a customizable table for displaying data. The DataGridView class enables customization of cells, rows, columns, and borders.

Note

The DataGridView control provides numerous basic and advanced features that are missing in the DataGrid control. For more information, see Differences Between the Windows Forms DataGridView and DataGrid Controls

Data binding and navigation

BindingSource component

Simplifies binding controls on a form to data by providing currency management, change notification, and other services.

BindingNavigator control

Provides a toolbar-type interface to navigate and manipulate data on a form.

Text editing

TextBox control

Displays text entered at design time that can be edited by users at run time, or changed programmatically.

 

RichTextBox control

Enables text to be displayed with formatting in plain text or rich-text format (RTF).

 

MaskedTextBox control

Constrains the format of user input

Information display (read-only)

Label control

Displays text that users cannot directly edit.

LinkLabel control

Displays text as a Web-style link and triggers an event when the user clicks the special text. Usually the text is a link to another window or a Web site.

StatusStrip control

Displays information about the application's current state using a framed area, usually at the bottom of a parent form.

ProgressBar control

Displays the current progress of an operation to the user.

Web page display

WebBrowser control

Enables the user to navigate Web pages inside your form.

Selection from a list

CheckedListBox control

Displays a scrollable list of items, each accompanied by a check box.

ComboBox control

Displays a drop-down list of items.

DomainUpDown control

Displays a list of text items that users can scroll through with up and down buttons.

ListBox control

Displays a list of text and graphical items (icons).

ListView control

Displays items in one of four different views. Views include text only, text with small icons, text with large icons, and a details view.

NumericUpDown control

Displays a list of numerals that users can scroll through with up and down buttons.

TreeView control

Displays a hierarchical collection of node objects that can consist of text with optional check boxes or icons.

Graphics display

PictureBox control

Displays graphical files, such as bitmaps and icons, in a frame.

Graphics storage

ImageList control

Serves as a repository for images. ImageList controls and the images they contain can be reused from one application to the next.

Value setting

CheckBox control

Displays a check box and a label for text. Generally used to set options.

CheckedListBox control

Displays a scrollable list of items, each accompanied by a check box.

RadioButton control

Displays a button that can be turned on or off.

TrackBar control

Allows users to set values on a scale by moving a "thumb" along a scale.

Date setting

DateTimePicker control

Displays a graphical calendar to allow users to select a date or a time.

MonthCalendar control

Displays a graphical calendar to allow users to select a range of dates.

Dialog boxes

ColorDialog control

Displays the color picker dialog box that allows users to set the color of an interface element.

FontDialog control

Displays a dialog box that allows users to set a font and its attributes.

OpenFileDialog control

Displays a dialog box that allows users to navigate to and select a file.

PrintDialog control

Displays a dialog box that allows users to select a printer and set its attributes.

PrintPreviewDialog control

Displays a dialog box that displays how a control PrintDocument component will appear when printed.

FolderBrowserDialog control

Displays a dialog that allows users to browse, create, and eventually select a folder

SaveFileDialog control

Displays a dialog box that allows users to save a file.

Menu controls

MenuStrip control

Creates custom menus.

Note

The MenuStrip is designed to replace the MainMenu control.

ContextMenuStrip control

Creates custom context menus.

Note

The ContextMenuStrip is designed to replace the ContextMenu control.

Commands

Button control

Starts, stops, or interrupts a process.

LinkLabel control

Displays text as a Web-style link and triggers an event when the user clicks the special text. Usually the text is a link to another window or a Web site.

NotifyIcon control

Displays an icon in the status notification area of the taskbar that represents an application running in the background.

ToolStrip control

Creates toolbars that can have a Microsoft Windows XP, Microsoft Office, Microsoft Internet Explorer, or custom look and feel, with or without themes, and with support for overflow and run-time item reordering.

Note

The ToolStrip control is designed to replace the ToolBar control.

User Help

HelpProvider component

Provides pop-up or online Help for controls.

ToolTip component

Provides a pop-up window that displays a brief description of a control's purpose when the user rests the pointer on the control.

Grouping other controls

Panel control

Groups a set of controls on an unlabeled, scrollable frame.

GroupBox control

Groups a set of controls (such as radio buttons) on a labeled, nonscrollable frame.

TabControl control

Provides a tabbed page for organizing and accessing grouped objects efficiently.

SplitContainer control

Provides two panels separated by a movable bar.

Note

The SplitContainer control is designed to replace the Splitter control.

TableLayoutPanel control

Represents a panel that dynamically lays out its contents in a grid composed of rows and columns.

FlowLayoutPanel control

Represents a panel that dynamically lays out its contents horizontally or vertically.

Audio

SoundPlayer control

Plays sound files in the .wav format. Sounds can be loaded or played asynchronously.

Superseded Controls and Components by Function

Function

Superseded control

Recommended replacement

Data display

DataGrid

DataGridView

Information Display (Read-only controls)

StatusBar

StatusStrip

Menu controls

ContextMenu

ContextMenuStrip

MainMenu

MenuStrip

Commands

ToolBar

ToolStrip

StatusBar

StatusStrip

Form layout

Splitter

SplitContainer

See Also

Other Resources

Controls to Use on Windows Forms

Developing Custom Windows Forms Controls with the .NET Framework