Previous Section  < Day Day Up >  Next Section

Chapter 7. Windows Forms Controls

Topics in This Chapter

  • Introduction: A class hierarchy diagram offers a natural way to group Windows Forms controls by their functionality.

  • Button Controls: The Button, CheckBox, and RadioButton controls are designed to permit users to make one or more selections on a form.

  • PictureBox and TextBoxt Controls: The PictureBox control is used to display and scale images; the TextBox control can be used to easily display and edit single or multiple lines of text.

  • List Controls: The ListBox, ComboBox, and CheckListBox offer different interfaces for displaying and manipulating data in a list format.

  • ListView and TreeView Controls: The ListView offers multiple views for displaying data items and their associated icons. The TReeView presents hierarchical information in an easy-to-navigate tree structure.

  • Timer and Progress Bar Controls: A timer can be used to control when an event is invoked, a ProgressBar to visually monitor the progress of an operation.

  • Building a User Control: When no control meets an application's needs, a custom one can be crafted by combining multiple controls or adding features to an existing one.

  • Moving Data Between Controls: Drag and drop provides an easy way for users to copy or move an item from one control to another. .NET offers a variety of classes and events required to implement this feature.

  • Using Resources: Resources required by a program, such as title, descriptive labels, and images, can be embedded within an application's assembly or stored in a satellite assembly. This is particularly useful for developing international applications.

The previous chapter introduced the Control class and the methods, properties, and events it defines for all controls. This chapter moves beyond that to examine the specific features of individual controls. It begins with a survey of the more important .NET controls, before taking an in-depth look at how to implement controls such as the TextBox, ListBox, treeView, and ListView. Also included is a discussion of the .NET drag-and-drop features that are used to move or copy data from one control to another.

Windows Forms (WinForms) are not restricted to using the standard built-in controls. Custom GUI controls can be created by extending an existing control, building a totally new control, or fashioning a user control from a set of related widgets. Examples illustrate how to extend a control and construct a user control. The chapter concludes with a look at resource files and how they are used to create GUI applications that support users from multiple countries and cultures.

    Previous Section  < Day Day Up >  Next Section