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.
LINE Statement Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
' This example uses the LINE statement to display a series of screens with
' different line graphics.
' Note: To run this example, your screen must be 320 pixels wide by 200
' pixels high and must support CGA screen mode.
' To try this example:
' 1. Choose New Project from the File menu
' 2. Copy the example code below to the code window
' 3. Press F5 to run the example
SCREEN 1 ' Sets up the screen mode
LINE -(X2, Y2) ' Draw a line (in the foreground color) from
' the most recent point to X2, Y2.
DO
LOOP WHILE INKEY$ = "" ' Press any key to continue
CLS ' Clear the screen
LINE (0, 0)-(319, 199) ' Draw a diagonal line across the screen
DO
LOOP WHILE INKEY$ = "" ' Press any key to continue
CLS ' Clear the screen
LINE (0, 100)-(319, 100) ' Draw a horizontal line across the screen
DO
LOOP WHILE INKEY$ = "" ' Press any key to continue
CLS ' Clear the screen
LINE (10, 10)-(20, 20), 2 ' Draw a line in color 2
DO
LOOP WHILE INKEY$ = "" ' Press any key to continue
CLS ' Clear the screen
FOR X = 0 TO 319 ' Draw an alternating pattern (line on/line off)
LINE (X, 0)-(X, 199), X AND 1
NEXT
DO
LOOP WHILE INKEY$ = "" ' Press any key to continue
CLS ' Clear the screen
LINE (0, 0)-(100, 100), , B ' Draw a box in the foreground color
DO
LOOP WHILE INKEY$ = "" ' Press any key to continue
CLS ' Clear the screen
LINE STEP(0, 0)-STEP(200, 200), 2, BF ' Draws a filled box in color 2
' (coordinates are given as
' offsets with the STEP option)
DO
LOOP WHILE INKEY$ = "" ' Press any key to continue
CLS ' Clear the screen
LINE (0, 0)-(160, 100), 3, , &HFF00 ' Draws a dashed line from the
' upper-left corner to the center of
' the screen in color 3
DO
LOOP WHILE INKEY$ = "" ' Press any key to continue
SCREEN 1 ' Final example
LINE (110, 70)-(190, 120), , B
LINE (0, 0)-(320, 200), 3, , &HFF00