Line Command

Purpose

Draws a line on the screen.

Syntax

Line x1, y1, x2, y2 [,[color] [[,B | BF]]

Line (x1, y1) - (x2, y2) [,[color] [[,B | BF]]

Line x1, y1 To x2, y2 [,[color] [[,B | BF]]

Line - (x2, y2) [[,color] [,[B | BF]]

Line To x2, y2[[,color] [,[B | BF]]

Line [Step] x1, y1, [Step] x2, y2 [,[color] [[,B | BF]]

x1, y1, x2, y2:Single exp
color:iexp

Description

Line x1, y1, x2, y2 draws a line on the screen from the point with coordinates x1,y1 to the point with coordinates x2,y2. The origins of the coordinate system are in the upper left corner of the screen.

Step - Optional. Keyword specifying that the starting point coordinates are relative to the current graphics position given by the CurrentX and CurrentY properties

color - Optional. Long integer value indicating the RGB color used to draw the line. If omitted, the ForeColor property setting is used. You can use the RGB function or QBColor function to specify the color.

B - Optional. If included, causes a box to be drawn using the coordinates to specify opposite corners of the box.

F - Optional. If the B option is used, the F option specifies that the box is filled with the same color used to draw the box. You cannot use F without B. If B is used without F, the box is filled with the current Color and DefFill. The default value for F is transparent.

Example

OpenW # 1

Local i%

Color Rand(_C) - 1

For i% = 0 To 100 Step 2

Line 0, 0, Rand(_X), Rand(_Y)

Next i%

Draws lines as rays emanating from 0,0.

Remarks

The width, style, and color of the line can be defined using DefLine and Color, RGBColor, QBColor, BkColor commands.

Line (x1, y1) - (x2, y2) ,, BF is similar to PBox x1,y1, x2, y2

When Line executes, the CurrentX and CurrentY properties are set to the end point specified by the arguments.

See Also

Draw, Color, RGBColor, QBColor, BkColor, PBox, Box

{Created by Sjouke Hamstra; Last updated: 11/10/2014 by James Gaite}