Adding Controls to a Form

   

graphics/newterm.gif

Now that your form has its properties set, you need to add objects to the form to produce a user interface. 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 tab titled Toolbox. Click the Toolbox tab now to display the Toolbox window shown in Figure 1.6. The toolbox contains all the controls available in the project, such as labels and text boxes.

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

graphics/01fig06.jpg


graphics/bulb.gif

You can add a control to a form in three ways, and Hour 5 explains them in detail. In this hour , you'll use the technique of double-clicking a tool in the toolbox.

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

graphics/bookpencil.gif

Refer to Hour 2, "Navigating C#," for more information on customizing the design environment.

Your Picture Viewer interface will consist of the following controls:

  • Two Button controls

  • A PictureBox control

  • An OpenFileDialog control


   
Top


Sams Teach Yourself C# in 24 Hours
Sams Teach Yourself Visual Basic 2010 in 24 Hours Complete Starter Kit (Sams Teach Yourself -- Hours)
ISBN: 0672331136
EAN: 2147483647
Year: 2002
Pages: 253
Authors: James Foxall

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