Review Questions


1:

What does the term display resolution mean?

A1:

The display resolution refers to the number of picture elements, or pixels, that are present on a display. Most modern displays have display resolutions that are adjustable between 640x480 and 1280x1024.

2:

What does the term dot pitch mean and how does it impact a display?

A2:

The dot pitch of a display refers to the distance between pixels. Most modern displays have dot pitch values of approximately .28mm or less. Higher dot pitch values means that there is more black space between pixels. As a result, displays with relatively high dot pitch values produces images that look faded and washed out.

3:

What does image compression mean?

A3:

Every image that is displayed on a computer monitor is nothing more than a series of pixels that have specific color values assigned to them. As display device technology improved and increased the range of colors that could be displayed, so did the image's storage requirements. Engineers discovered that it was possible to decrease the storage requirements by encoding, or compressing, the pixel values. While this does decrease the storage requirements, some color detail and fidelity is lost in the process. However, the lost detail is often so small that it is almost undetectable to the human eye even though the image storage requirements may be one-tenth of its orginal value. JPEG is perhaps the most popular image compression currently in use.

4:

Suppose you want to use the OpenFileDialog control as part of an Access database program. You would like the control to default to Access database files (MDB), but also allow them to view all other file types if they wish. What statements are necessary to meet these design goals?

A4:

The statements could be written:

 With OpenFileDialog1  ' Initialize the file dialog   .Filter = "Access Database (*.MDB)*.MDBAll Files (*.*)*.*"  .FilterIndex = 1 End With 

The Filter property of the OpenFileDialog is used to limit the file types that are displayed. The FilterIndex property is used to determine which file type in the Filter property's list is used as the default file type. In this example, we have made MDB the default file type by setting the FilterIndex property to the first file type specified in the Filter list.

5:

What is the aspect ratio of an image and why is it important?

A5:

The aspect ratio is the ratio of an image's width to its height. For example, if an image is 1000 pixels wide and 1000 pixels high, its aspect ratio is 1.0. However, if you try to display that image in an area on the display that is 1000x800, the height of the image is going to be squished so the 1000 pixels of the original image can be shoe-horned into the 800 pixels that are available. As a result, the image will look distorted . To prevent image distortion, the aspect ratio for the image must match the aspect ratio of the display device.

6:

Assuming that the original size of an image is too large to be displayed in a PictureBox control and you do not want to scroll the image, what steps are necessary to display the control?

A6:

First, you need to determine the aspect ratio of the image. Next, you resize the PictureBox control to have the same aspect ratio as the image. For example, if the image is 1600x1200, the same relative size must be maintained for the PictureBox control. A PictureBox size of 400x300 would maintain the proper aspect ratio. Finally, you need to make sure that the SizeMode property is set to StretchImage with a statement similar to:

 PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage 
7:

What is the difference between a Pen object and a SolidBrush object?

A7:

Usually, a Pen object is used for drawing shapes , lines, or text. A Brush object is used to fill in objects and shapes that have been drawn.

8:

Assume a variable named Where defines an image name and where to find it. In as few statements as possible, calculate the aspect ratio of the image.

A8:

The statements might be written as

 Dim Aspect As Double  Dim Picture As Image = Image.FromFile(Where) Aspect = CDbl(Picture.Height) / CDbl(Picture.Width) 

The code defines an Image object named Picture and initializes it to the image in question. The Height and Width properties of the Image object can then be used to calculate the aspect ratio of the image.

9:

What is the difference between the DrawRectangle() and FillRectangle() methods ?

A9:

The DrawRectangle() graphics method uses a Pen object to draw an outline of a rectangle using the current properties of the pen (such as the color used to draw the rectangle). The FillRectangle() method draws a solid rectangle using whatever properties are currently active for the brush object being used.

10:

Suppose you wish to change the default font for a graphics object. What statements would you use?

A10:

At a minimum, you would need to use a statement similar to

 Dim MyFont As Font = New Font("Microsoft Sans Serif", 8, FontStyle.Regular) 

plus whatever statements may be necessary to instantiate a graphics object. You could then use MyFont in whatever graphics routine (for example, DrawString() ) you wished.



Visual Basic .NET. Primer Plus
Visual Basic .NET Primer Plus
ISBN: 0672324857
EAN: 2147483647
Year: 2003
Pages: 238
Authors: Jack Purdum

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net