Home > Articles

A C# Programming Tou

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

This chapter is from the book

Adding Controls to a Form

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.


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.


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

  • + Share This
  • 🔖 Save To Your Account