30.07.2013 Views

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

Visual Basic.NET How to Program (PDF)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

714 Graphics and Multimedia Chapter 16<br />

16.9 Introduction <strong>to</strong> Multimedia<br />

<strong>Visual</strong> <strong>Basic</strong> offers many convenient ways <strong>to</strong> include images and animations in programs.<br />

People who entered the computing field decades ago used computers primarily <strong>to</strong> perform<br />

arithmetic calculations. As the discipline evolves, we are beginning <strong>to</strong> realize the importance<br />

of computers’ data-manipulation capabilities. We are seeing a wide variety of exciting<br />

new three-dimensional applications. Multimedia programming is an entertaining and<br />

innovative field, but one that presents many challenges<br />

Multimedia applications demand extraordinary computing power. Until recently,<br />

affordable computers with this amount of power were not available. <strong>How</strong>ever, <strong>to</strong>day’s<br />

ultrafast processors are making multimedia-based applications commonplace. As the<br />

market for multimedia explodes, users are purchasing faster processors, larger memories<br />

and wider communications bandwidths needed <strong>to</strong> support multimedia applications. This<br />

benefits the computer and communications industries, which provide the hardware, software<br />

and services fueling the multimedia revolution.<br />

In the remaining sections of this chapter, we introduce the use and manipulation of<br />

images, as well as other multimedia features and capabilities. Section 16.10 discusses how<br />

<strong>to</strong> load, display and scale images; Section 16.11 demonstrates image animation;<br />

Section 16.12 presents the video capabilities of the Windows Media Player control; and<br />

Section 16.13 explores Microsoft Agent technology.<br />

16.10 Loading, Displaying and Scaling Images<br />

<strong>Visual</strong> <strong>Basic</strong>’s multimedia capabilities include graphics, images, animations and video.<br />

Previous sections demonstrated <strong>Visual</strong> <strong>Basic</strong>’s vec<strong>to</strong>r-graphics capabilities; this section<br />

concentrates on image manipulation. The Windows form that we create in Fig. 16.23 demonstrates<br />

the loading of an Image (System.Drawing namespace). The application allows<br />

users <strong>to</strong> enter a desired height and width for the Image, which then is displayed in<br />

the specified size.<br />

1 ' Fig. 16.23: DisplayLogo.vb<br />

2 ' Displaying and resizing an image.<br />

3<br />

4 Public Class FrmDisplayLogo<br />

5 Inherits System.Windows.Forms.Form<br />

6<br />

7 ' width controls<br />

8 Friend WithEvents txtWidth As TextBox<br />

9 Friend WithEvents lblWidth As Label<br />

10<br />

11 ' height controls<br />

12 Friend WithEvents lblHeight As Label<br />

13 Friend WithEvents txtHeight As TextBox<br />

14<br />

15 Private mGraphicsObject As Graphics<br />

16 Private mImage As Image<br />

17<br />

Fig. 16.23 Image resizing (part 1 of 3).

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

Saved successfully!

Ooh no, something went wrong!