Displaying Graphics on a Form
You can add graphics to forms A graphic can be displayed either as a foreground graphic, using a picture box or image control as the display area for a bitmap , icon , or metafile , or as a background graphic, using the entire Form window as the display area. You can also add graphics at run time with code. and controls at design time by setting the Picture property in the Properties window or by copying graphics from other applications and pasting them into Visual Basic.
To add a foreground graphic at design time using the Properties window
1. Draw a picture box or image control on the form.
2. In the Properties window , select Picture .
In the Settings box , Visual Basic displays the current type of image and the down arrow to the right of the Settings box changes into a button with three dots .
3. Click the button with three dots.
Visual Basic displays the Load Picture dialog box.
4. In the dialog box, select or type the name of the graphic file you want.
5. Choose OK.
Visual Basic displays the graphic inside the picture box. If necessary, resize the picture box.
To add a background graphic at design time using the Properties window
1. Click a blank part of the form to select it.
2. From the Properties window, select Picture.
3. Follow steps 3-5 as listed above.
Visual Basic displays the graphic inside the Form window. If necessary, resize the form.
To add a graphic at design time by copying and pasting
1. Open the other application and copy the graphic to the Clipboard.
2. Switch to Visual Basic.
3. Select the form or control onto which you want to paste the graphic.
4. From the Edit menu, choose Paste (Ctrl+V).
Note To delete a graphic at design time, select the Picture property in the Properties window and delete the contents of the Settings box.
Full-screen bitmaps for forms can be memory-intensive. To save memory, use a picture box or image control to display a foreground graphic.
When using a Picture box, set the AutoSize When Autosize is set to False, the size of the control remains constant and graphics are clipped when they exceed the area of the control. property to True to automatically resize the control to fit the picture.
Drawing Lines and Shapes on a Form
Picture Box Control
Setting Form and Control Properties
Learning Visual Basic:
Using Color and Graphics
Chapter 15, "Creating Graphics for Applications"