* *
*
* * News
 • Daily news
 • Archived news

Columns
 • WildCard
 • Qbasic Articles
 • QB Comic!

Learning center
 • QB Books
 • Qbasic Lessons!
 • Qbasic FAQ
 • Newbies Section
 • Qbasic Tutorials

* *
*
*
*
*  
.DRAW Statement Programming Examples.

  QuickSCREEN      Details     Example      Contents      Index
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
DRAW Statement Programming Examples
Example 1
 
The following program draws a triangle's outline in magenta and paints
the interior cyan:
 
SCREEN 1
DRAW "C2"             'Set color to magenta.
DRAW "F60 L120 E60"   'Draw a triangle.
DRAW "BD30"           'Move down into the triangle.
DRAW "P1,2"           'Paint interior.
 
Example 2
 
The following example shows different ways of using the M macro
command: with absolute movement and relative movement; using string-
variable arguments; and using numeric-variable arguments.
 
SCREEN 2
'Absolute movement
DRAW "M 50,80"
DRAW "M 80,50"
'Relative movement
DRAW "M+40,-20"
DRAW "M-40,-20"
DRAW "M-40,+20"
DRAW "M+40,+20"
'Using a string variable.
X$ = "400" : Y$ = "190"
DRAW "M" + X$ + "," + Y$
'Using numeric variables (note the two "=" signs).
A = 300 : B = 120
DRAW "M="+VARPTR$(A)+",="+VARPTR$(B)
 
Example 3
 
DRAW_EX.BAS is a program file in the subdirectory ADVR_EX that illustrates
the DRAW statement. To look at the program in the View window and,
optionally, to run it, load DRAW_EX.BAS using the File menu's Open Program
command.
 
The program draws a clock on the screen using the TIME$ function.
* * ** * * * *