QBasic 1.1: DRAW Statement


DRAW commandstring$

Description / Parameter(s)

commandstring$ A string expression that contains one or more of the following DRAW commands.
Line-drawing and cursor-movement commands:
D[n%] Moves cursor down n% units.
E[n%] Moves cursor up and right n% units.
F[n%] Moves cursor down and right n% units.
G[n%] Moves cursor down and left n% units.
H[n%] Moves cursor up and left n% units.
L[n%] Moves cursor left n% units.
M[{+|-}]x%,y% Moves cursor to point x%,y%. If x% is preceded by + or -, moves relative to the current point.
R[n%] Moves cursor right n% units.
U[n%] Moves cursor up n% units.
[B] Optional prefix that moves cursor without drawing.
[N] Optional prefix that draws and returns cursor to its original position.

Color, rotation, and scale commands:
An% Rotates an object n% * 90 degrees (n% can be 0, 1, 2, or 3).
Cn% Sets the drawing color (n% is a color attribute).
Pn1%,n2% Sets the paint fill and border colors of an object (n1% is the fill-color attribute, n2% is the border-color attribute).
Sn% Determines the drawing scale by setting the length of a unit of cursor movement. The default n% is 4, which is equivalent to 1 pixel.
TAn% Turns an angle n% degrees (-360 through 360).
If you omit n% from line-drawing and cursor-movement commands, the cursor moves 1 unit.
To execute a DRAW command substring from a DRAW command string, use the "X" command:
DRAW "X"+ VARPTR$(commandstring$)


'This example requires a color graphics adapter. SCREEN 1 Triangle$ = "F60 L120 E60" DRAW "C2 X" + VARPTR$(Triangle$) DRAW "BD30 P1,2 C3 M-30,-30"