Appendix B. 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.

Unless otherwise noted, all the controls listed here are in the System.Windows.Forms namespace (which you need to know to enter the correct URL).

CONTROL

PURPOSE

BackgroundWorker

Executes a background task on a separate thread. Events provide notification of progress and completion (System.ComponentModel namespace).

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.

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.

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 options.

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 one of four different views: LargeIcon, SmallIcon, Details, and Tile.

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 it).

PrintDialog

A dialog that allows the user to select a printer, set printer properties, 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.

Process

Lets a program control processes running on the system. You can use the Start method to run the default application for a file.

ProgressBar

Indicates the progress of some task to the user.

PropertyGrid

Displays an object's properties at run time and lets the user edit them, much like the Properties window lets you change a control's properties at design time.

RadioButton

A radio button.

RichTextBox

Lets the user edit text. Can display multiple fonts, images, bulleted and numbered lists, and other formats.

SaveFileDialog

A dialog that lets the user select a file for saving. Can prompt the user to overwrite the file if it already exists.

SerialPort

Allows a program to control serial ports (System.IO.Ports namespace).

ServiceController

Allows a program to control Windows services (System.ServiceProcess namespace).

SplitContainer

Displays two Panels separated by a Splitter to let the user easily resize the panels.

StatusStrip

A status bar, usually displayed at the bottom of a form.

TabControl

Displays a series of tabs holding groups of controls.

TableLayoutPanel

A panel that arranges its contents in rows and columns.

TextBox

Lets the user edit text in a single font.

Timer

A component that raises a Tick event at regular repeating intervals.

ToolStrip

A toolbar.

ToolStripContainer

A container that can hold ToolStrips. The user can drag the ToolStrips to new positions within the ToolStripContainer.

ToolTip

Displays a tooltip for other controls when the mouse hovers over them.

TrackBar

Displays a trackbar that lets the user select a numeric value. It behaves much like a scrollbar does but with a different appearance.

TreeView

Displays a hierarchical set of items, much like the left panel in Windows Explorer normally does (if you haven't customized its appearance).

VScrollBar

A vertical scrollbar.

WebBrowser

A web browser control. You can use this to control a browser inside your application. For example, your program can go to specific sites, examine URLs and cancel navigation for some URLs, examine the links and images on a web page, and so on.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset