GRAPHIC LINE statement

Purpose

Draw a line

Syntax

GRAPHIC LINE [STEP] [(x1!, y1!)] - [STEP] (x2!, y2!)[, rgbColor&]

Remarks

The line is drawn from the first point, up to, but not including the second point.  The coordinate points are specified in pixels, unless optional world coordinates have been requested with a GRAPHIC SCALE statement. Line width can be set using GRAPHIC WIDTH.  If line width is set to 1 (the default), the line style can be set with GRAPHIC STYLE.

Windows graphic conventions consider the final x2 and y2 coordinates to be exclusive.  Therefore, by default, the final pixel is not drawn unless Overlap Mode is enabled.  See GRAPHIC SET OVERLAP for details.

x1!, y1!

Optional values which define the starting point of the line. If this optional first point is omitted, the line begins at the last point referenced (POS) in a preceding GRAPHIC statement.  If the first STEP option is included, the x1! and y1! starting coordinates are relative to the last point referenced (POS).

x2!, y2!

The ending point of the line.  If the second STEP option is included, the x2! and y2! ending coordinates are relative to the starting coordinates.

rgbColor&

Optional RGB color value for the line.  If rgbColor& is omitted (or -1), the line color defaults to the current foreground color.

See also

GRAPHIC ARC, GRAPHIC ATTACH, GRAPHIC BOX, GRAPHIC COLOR, GRAPHIC ELLIPSE, GRAPHIC PIE, GRAPHIC SET OVERLAP, GRAPHIC STYLE, GRAPHIC WIDTH

Example

' Draw a triangle. Note that, since LINE draws up to,

' but not including the second point, one extra point

' must be added when STEP is used.

GRAPHIC LINE (10, 10) - (10, 100)  ' left side

GRAPHIC LINE STEP - (101, 100)     ' base line

GRAPHIC LINE STEP - (10, 10)       ' back to top