Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
This chapter is from the book

7.10 Summary

There are more than 50 GUI controls available in the .NET Framework Class Library. This chapter has taken a selective look at some of the more important ones. They all derive from the System.Windows.Forms.Control class that provides the inherited properties and methods that all the controls have in common.

Although each control is functionally unique, it is possible to create a taxonomy of controls based on similar characteristics and behavior. The button types, which are used to intitiate an action or make a selection, include the simple Button, CheckBox, and RadioButton. These are often grouped using a GroupBox or Panel control. The TextBox can be used to hold a single line of text or an entire document. Numerous methods are available to search the box and identify selected text within it. The PictureBox is available to hold images and has a SizeMode property that is used to position and size an image within the box.

Several controls are available for presenting lists of data. The ListBox and ComboBox display data in a simple text format. However, the underlying data may be a class object with multiple properties. The TreeView and ListView are useful for displaying data with a hierarchical relationship. The ListView can display data in multiple views that include a grid layout and icon representation of data. The TreeView presents a tree metaphor to the developer, with data represented as parent and child nodes.

Most of the controls support the drag-and-drop operation that makes it easy to move or copy data from one control to another. The source control initiates the action by calling a DoDragDrop method that passes the data and permissible effects to the target control.

For applications that require nonstandard controls, .NET lets you create custom controls. They may be created from scratch, derived from an existing control, or created as a combination of controls in a user control container.

  • + Share This
  • 🔖 Save To Your Account