Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
PAINT Statement Details
◄Summary► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
PAINT [STEP] (x!,y!)[,[{color% | tile$}] [,[bordercolor&] [,background$]]]
Usage Notes
■ You must be in a graphics screen mode (for example, screen mode 1) to
use the PAINT statement; otherwise, Visual Basic may generate the error
message, "Illegal function call." See: ◄SCREEN Statement►
■ The available color attributes for PAINT depend on your graphics adapter
and the screen mode set by the most recent SCREEN statement.
See: ◄Adapters and Displays►
■ The coordinates (x!,y!) must be inside or outside a figure, not on the
border itself. If this point is inside, the figure's interior is
painted; if the point is on the outside, the background is painted.
■ The argument background$ is a string value giving the "background tile
slice" to skip when checking for boundary termination. Painting stops
when adjacent points display the paint color. Specifying a background
tile slice allows you to paint over an already painted area.
■ If you specify more than two consecutive bytes that match the tile
string in the background tile slice, Visual Basic generates the error
message, "Illegal function call."
■ When you omit background$ in a PAINT statement, the default is CHR$(0).
See: ◄CHR$ Function►
■ Painting is complete when a line is painted without changing the color
of any pixel; in other words, when the entire line is equal to the paint
color. The PAINT statement permits coordinates outside the screen or
viewport.
■ PAINT stops filling an area when it encounters a border of the specified
color.
■ "Tiling" is the design of a PAINT pattern represented in string form;
tiling can be done to produce varied patterns of different colors. The
tile string is 8 bits wide and up to 64 bytes long. Each byte masks
8 bits along the x axis when plotting points. Use the following syntax
to construct the tile mask:
A$ = CHR$(arg1) + CHR$(arg2) + ... + CHR$(argn)
PAINT (x,y), A$
The arguments to CHR$ are numbers between 0 and 255, represented in
binary form across the x axis of the tile. Each CHR$(argn) defines a
1-byte, 8-pixel slice of the fill pattern based on the binary form of
the number. There can be up to 64 of these CHR$ elements; each element
generates an image of the bit arrangement of the code for that
character, rather than an image of the assigned character.
For example, the decimal number 85 is binary 01010101. The graphic image
line on a black-and-white screen generated by CHR$(85) is an 8-pixel
line, with even-numbered points white and odd-numbered points black:
• Each bit equal to 1 turns the associated pixel on
• Each bit equal to 0 turns the associated bit off
Note: The ASCII character CHR$(85), which is U, is not displayed in
this case. See: ◄CHR$ Function►