Sams Teach Yourself Visual Basic 6 in 24 Hours

Sams Teach Yourself Visual Basic 6 in 24 Hours

By Greg Perry

Q&A

  1. Can I use graphic images other than the ones that Visual Basic supplies?

    Certainly. Both the Image control and the Picture Box control load images from any file that uses one of Table 18.1's graphic file formats. As a matter of fact, Visual Basic's images are fairly limited, and most of them are useful for command button pictures and toolbars but very little else.

  2. Did you just say command button pictures? When I click the command button's Picture property, no picture appears on the command button, so what's wrong?

    This is as good a time as any to describe how to put pictures on command buttons. After you set the command button's Picture property, you must also set the Style property to 1-Graphical. Only a graphical command button can display pictures. The command button works just like before, but now a picture appears. (Erase the Caption property if the caption overwrites the picture's image.) You did not learn about command button pictures in earlier lessons because you were not yet familiar with the LoadPicture() function. You can use LoadPicture() to insert a picture on a command button at runtime if you need to do that. Often, programmers will display a slightly different picture on a command button after the user clicks the button, and you can use LoadPicture() to do the same.

  3. If speed is no longer an issue, why should I ever use the Image control?

    Although the Image control is slightly more efficient, you are correct in remembering that today's computers are generally fast enough to handle both the Picture Box control and the Image control for any application. If, however, you work in a networked environment or if you set up your Windows desktop to run several applications simultaneously, you will want to utilize all resources as efficiently as possible. Therefore, you might prefer to use the Image control to lessen your computer's load if you don't need the Picture Box control's extra properties, events, and methods.

Share ThisShare This

Informit Network