Guaranteed Hits to your web site!












Learn Visual Basic 6.0


4. More Exploration of the Visual Basic Toolbox


Picture Boxes


Picture Box

  1. The picture box allows you to place graphics information on a form. It is best suited for dynamic environments - for example, when doing animation.

  2. Picture boxes lie in the top layer of the form display. They behave very much like small forms within a form, possessing most of the same properties as a form.

  3. Picture Box Properties:
  4. Picture Box Events:
  5. Picture Box Methods:
  6. Examples

    picExample.Cls ' clears the box picExample
    picExample.Print "a picture box" ' prints text string to picture box
  7. Picture Box LoadPicture Procedure:

    An important function when using picture boxes is the LoadPicture procedure. It is used to set the Picture property of a picture box at run-time.

    Example
    This command loads the graphics file c:\pix\sample.bmp into the Picture property of the picExample picture box. The argument in the LoadPicture function must be a legal, complete path and file name, else your program will stop with an error message.

  8. Five types of graphics files can be loaded into a picture box:

    Bitmap An image represented by pixels and stored as a collection of bits in which each bit corresponds to one pixel. Usually has a .bmp extension. Appears in original size.
    Icon A special type of bitmap file of maximum 32 x 32 size. Has a .ico extension. We�ll create icon files in Class 5. Appears in original size.
    Metafile A file that stores an image as a collection of graphical objects (lines, circles, polygons) rather than pixels. Metafiles preserve an image more accurately than bitmaps when resized. Has a .wmf extension. Resizes itself to fit the picture box area.
    JPEG JPEG (Joint Photographic Experts Group) is a compressed bitmap format which supports 8 and 24 bit color. It is popular on the Internet. Has a .jpg extension and scales nicely.
    GIF GIF (Graphic Interchange Format) is a compressed bitmap format originally developed by CompuServe. It supports up to 256 colors and is popular on the Internet. Has a .gif extension and scales nicely.


Pen Line


Counter Hit Counter Hit


This Homepage is special brought to you by CK Tan
Hosted by www.Geocities.ws

1