Drawing Objects with Visual Basic
Despite the different varieties of user interfaces available, most graphical user interfaces share similar features such as displaying text or pictures in a window. A window can fill the entire screen or just part of it. Two or more windows can appear on the screen at the same time, either overlapping like cards or side by side like tiles. For some odd reason, Visual Basic calls a window a form.
When you first create a form, it’s entirely blank. To make your form useful, you have to draw objects on the form. An object can be a command button, a text box, a picture, or an option button. The user communicates with your program by clicking, typing, or manipulating the objects displayed on a form.
To draw objects on a form, you need to use the Toolbox, which normally appears on the left side of the screen (unless you move it somewhere else). The Toolbox contains little drawings that represent the various objects you can draw on a form, as shown in Figure 1.
To draw any object on a form, you always have to follow these steps:
1. Click on the object in the Toolbox to tell Visual Basic what you want to draw on a form.
2. Move the mouse pointer onto the form where you want to draw the object.
3. Hold down the left mouse button and drag the mouse to draw your chosen object on the form.
As a fast way to draw an object on a form, just double-click on an icon in the Toolbox and Visual Basic draws your chosen object in the center of the form automatically.
Designing your user interface is a lot like doodling. Just remember two things: All programs need a user interface, and Visual Basic uses forms and objects to help you create a user interface quickly and easily.