19.12.2012 Views

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

Computer Programming Concepts and Visual Basic David I. Schneider

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

302 <strong>Computer</strong> <strong>Programming</strong> <strong>Concepts</strong> <strong>and</strong> <strong>Visual</strong> <strong>Basic</strong><br />

FIGURE 10-7 Several Effects Achieved with Shape Controls<br />

THE LINE CONTROL<br />

The Line control, which produces lines of various thickness, styles, <strong>and</strong> colors, is primarily used<br />

to enhance the visual appearance of forms. The most useful properties of lines are BorderColor<br />

(color of the line), BorderWidth (thickness of the line), BorderStyle (solid, dashed, dotted,<br />

etc.), <strong>and</strong> Visible. Figure 10-8 shows several effects that can be achieved with lines. By convention,<br />

names of line controls have the prefix lin.<br />

FIGURE 10-8 Several Effects Achieved with Line Controls<br />

THE IMAGE CONTROL<br />

The image control is designed to hold pictures stored in graphics files such as .BMP files created<br />

with Windows’ Paint, .ICO files of icons that come with <strong>Visual</strong> <strong>Basic</strong>, or .GIF <strong>and</strong> JPEG<br />

images used on the World Wide Web. Pictures are placed in image controls with the Picture<br />

property. If you double-click on the Picture property during design time, a file-selection dialog<br />

box appears <strong>and</strong> assists you in selecting an appropriate file. However, prior to setting the<br />

Picture property, you should set the Stretch property. If the Stretch property is set to False (the<br />

default value), the image control will be resized to fit the picture. If the Stretch property is set<br />

to True, the picture will be resized to fit the image control. Therefore, with Stretch property<br />

True, pictures can be reduced (by placing them into a small image control) or enlarged (by placing<br />

them into an image control bigger than the picture). Figure 10-9 shows a picture created<br />

with Paint <strong>and</strong> reduced to several different sizes. By convention, names of image controls have<br />

the prefix img.<br />

A picture can be assigned to an image control at run time. However, a statement such as<br />

imgBox.Picture = “filespec”<br />

will not do the job. Instead, we must use the LoadPicture function in a statement such as<br />

imgBox.Picture = LoadPicture(“filespec”)<br />

Image controls enhance the visual appeal of programs. Also, because image controls respond<br />

to the Click event <strong>and</strong> can receive the focus, they can serve as pictorial comm<strong>and</strong> buttons.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!