Visual Basic Concepts

The Fundamentals of Drawing with Graphics Methods

See Also

Every graphics method draws output on a form, in a picture box, or to the Printer object. To indicate where you want to draw, precede a graphics method with the name of a form or picture box control. If you omit the object, Visual Basic assumes you want to draw on the form to which the code is attached. For example, the following statements draw a point on:

Each drawing area has its own coordinate system that determines what units apply to the coordinates. In addition, every drawing area has its own complete set of graphics properties.

For More Information   See "Printing from an Application" later in this chapter for more information about the Printer object. See "Understanding the Coordinate System" for more information about coordinates.

Clearing the Drawing Area

Any time you want to clear a drawing area and start over, use the Cls method. The specified drawing area is repainted in the background color (BackColor):

[object.]Cls

Using the Cls method without a specified object clears the form to which the code is attached.