- Starting C#
- Creating a New Project
- Understanding the C# Environment
- Changing the Characteristics of Objects
- Naming Objects
- Setting the Text Property of the Form
- Giving the Form an Icon
- Changing the Size of the Form
- Adding Controls to a Form
- Designing an Interface
- Adding an Invisible Control to a Form
- Coding an Interface
- Running a Project
- Summary
- Q&A
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.
NOTE
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.
NOTE
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