Control Summary
This appendix summarizes the purposes of the most common Windows Forms controls. The
intent of this appendix is to let you know what kinds of controls are available, not to provide
an exhaustive reference.
For additional details on how to use a control, see the online documentation. The web page
describing a control is named after the control including its namespace. For example, the web
page describing the
ComboBox class is msdn.microsoft.com/library/system.windows
.forms.combobox.aspx
.
All of the controls listed here are in the
System.Windows.Forms namespace (which you need
to know to enter the correct URL) unless otherwise noted.
Control PurPose
BackgroundWorker
Executes a background task in parallel on a separate thread.
Events provide notification of progress and completion (
System.
ComponentModel
namespace).
BindingNavigator
Provides a user interface for controls bound to a data source.
BindingSource
Encapsulates a data source for a form. Provides methods for
manipulating the data.
Button
A button.
CheckBox
A checkbox.
CheckedListBox
A list of items with checkboxes that let the user easily select one
or more items without needing the Click/Shift+Click/Ctrl+Click
techniques used by the regular
ListBox control.
ColorDialog
A dialog that lets the user select a color.
ComboBox
A combo box.
B
continues
596906bapp02.indd 477 4/7/10 12:35:32 PM
478
APPendix B Control Summary
Control PurPose
ContextMenuStrip
A context menu. Assign this object to another control’s
ContextMenu property and the menu automatically appears
when the user right-clicks the control.
DataGridView
Displays a grid of data, possibly bound to a data source.
DataSet
An in-memory representation of a database.
DateTimePicker
Allows the user to select a date and a time.
DomainUpDown
Displays a spin box (up-down control) that lets the user scroll
through a list of predefined choices.
ErrorProvider
Displays an error indicator for other controls.
EventLog
Allows a program to interact with system event logs (System.
Diagnostics
namespace).
FileSystemWatcher
Raises events when a directory or file changes so you can keep
track of it (although I’ve had mixed success with this control)
(
System.IO namespace).
FlowLayoutPanel
A panel that dynamically arranges its contents in either rows or
columns.
FolderBrowserDialog
A dialog that lets the user select a folder (directory).
FontDialog
A dialog that lets the user select a font.
Form
Displays a window on the desktop.
GroupBox
Groups controls inside an outline and displays a header for the
group.
HelpProvider
Provides a tooltip or online help for other controls.
HScrollBar
A horizontal scrollbar.
ImageList
Stores a list of images for use by other controls.
Label
Displays non-editable text in a single font.
LinkLabel
Displays a label that contains a hyperlink. When the user clicks
the hyperlink, the control raises an event so the program can
take action.
ListBox
Displays a list of items.
ListView
Displays a group of items in four dierent views: LargeIcon,
SmallIcon, Details, and Tile.
(continued)
596906bapp02.indd 478 4/7/10 12:35:32 PM
APPendix B Control Summary
479
Control PurPose
MaskedTextBox
Similar to a TextBox except it displays an input mask to prompt
the user and restrict entry. For example, a telephone mask might
look like (___)-___-____.
MenuStrip
A form’s main menu.
MessageQueue
Provides tools for creating and interacting with message queues
(
System.Messaging namespace).
MonthCalendar
Allows the user to select a date or date range from a calendar.
NotifyIcon
Displays an icon in the notification area or system tray (usually
on the right end of the taskbar). Can provide a context menu,
and the program can use the icon to indicate status to the user.
NumericUpDown
Displays a spin box (up-down control) that lets the user pick a
numeric value.
OpenFileDialog
A dialog that lets the user select a file for opening. Can require
that the file actually exists.
PageSetupDialog
A dialog that allows the user to define printer page settings,
such as margins and printout orientation.
Panel
A simple container that holds other controls. Set AutoScroll
= true to make the
Panel automatically display scrollbars if
needed. (This is its coolest feature!)
PerformanceCounter
Provides access to Windows NT performance counters
(
System.Diagnostics namespace).
PictureBox
Displays an image. The SizeMode property determines how
the image is sized and can take the values
Normal (clip the
image if it doesn’t fit),
StretchImage (make the image fit
the
PictureBox even if that distorts it), AutoSize (size the
PictureBox to fit the image), CenterImage (center the image,
clipping it if it is too big), and
Zoom (make the image as large as
possible without distorting its shape).
PrintDialog
A dialog that allows the user to select a printer, set printer prop-
erties, and pick the pages to print.
PrintDocument
Represents a printed document. Catch the PrintPage event to
generate output.
PrintPreviewControl
Displays a preview of a PrintDocument in a control.
PrintPreviewDialog
Displays a preview of a PrintDocument in a dialog.
continues
596906bapp02.indd 479 4/7/10 12:35:32 PM

Get Stephens' C# Programming with Visual Studio® 2010 24-Hour Trainer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.