Chapter 7


Home

Chapter 1

Chapter 2

Chapter 3

Chapter 4

Chapter 5

Chapter 6

Chapter 7

Chapter 8

Chapter 9

Chapter 10

Chapter 11

Chapter 12

Chapter 13

Chapter 14

Chapter 15

Table of Contents


Graphics

A pixel is the smallest graphic element of a display screen. The word is short for "picture element."

Screen dimensions are listed as pixels across by pixels down, for instance, 640x480 is a typical VGA resolution.

A font is a style of type. A printer's point is about 1/72 of an inch. A twip is 1/20 of a point.

Visual Basic provide seven built-in coordinate systems based on twips, points, pixels, characters, inches, millimeters, and centimenters. User-defined coordinate systems are also supported.

The picutre box has many uses. It can be:

  • Drawn upon with drawing controls like the shape and line controls from the toolbox;
  • Drawn upon by graphics methods, like Line, PSet, and Circle;
  • A container for labels, textboxes, or other controls from the toolbox;
  • A container for an icon, a bitmap, or a metafile.
  • The image box allows an icon or bitmap to be stretched and distorted. The value of the ScaleMode property determines the kind of coordinate system used. The ScaleWidth and ScaleHeight properties hold the dimensions of forms and picture boxes. These values depend on the size of the object and the coordinate system chosen in the ScaleMode property.

    The PSet method will plot a point of a given color on the screen. It syntax is:

      object.PSet(x,y), color

    where (x,y) is the coordinate of the point, and color is the color of the plotted point. The first coordinate is the column number (or horizontal position) and the second is the row number (or vertical position).

    The Cls method clears the contents of a picture box or a form.

    The DrawWidth property sets the size of the dot drawn by any of the drawing methods, like PSet and Line.

    The QBColor function generates one of 16 colors. The RGB function lets the user specify 256 choices each for the red, gree, and blue components of a composite color. The color is represented by a long integer.

    The Line method draws a line between two points. It can draw a box, using the two coordinates as diagonal corners of the box, or a line from the previously plotted point to a point contained in the Line statement. The Circle method draws a complete or partial circle or ellipse.