Adding Controls to a Form


Now that you've set the initial properties of your form, it's time to create a user interface by adding objects to the form. Objects that can be placed on a form are called controls. Some controls have a visible interface with which a user can interact, whereas others are always invisible to the user. You'll use controls of both types in this example. On the left side of the screen is a vertical tab titled Toolbox. Click the Toolbox tab now to display the Toolbox window and click the plus sign next to Common Controls to see the most commonly used controls (see Figure 1.8). The tool-box contains all the controls available in the project, such as labels and text boxes.

Figure 1.8. The toolbox is used to select controls to build a user interface.


Did you Know?

There are four ways to add a control to a form, and Hour 5 explains them in detail. In this hour, you will use the technique of double-clicking a tool in the tool-box and copying and pasting a control.


The toolbox will close as soon as you've added a control to a form and when the pointer is no longer over the toolbox. To make the toolbox stay visible, you would click the little picture of a pushpin located in the toolbox's title bar.

By the Way

See Hour 2 for more information on customizing the design environment.


I don't want you to add them yet, but your Picture Viewer interface will consist of the following controls:

  • Two Button controls The standard buttons that you're used to clicking in pretty much every Windows program you've ever run

  • A PictureBox control A control used to display images to a user

  • An OpenFileDialog control A hidden control that exposes the Windows Open File dialog box functionality




Sams Teach Yourself Microsoft Visual C# 2005 in 24 Hours, Complete Starter Kit
Sams Teach Yourself Visual C# 2005 in 24 Hours, Complete Starter Kit
ISBN: 0672327406
EAN: 2147483647
Year: N/A
Pages: 248
Authors: James Foxall

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net