DrawLine

Draws lines and rectangles on an object.

Syntax

object.DrawLine x1, y1, x2, y2, [color], [vbLineBox | vbLineBoxFill]

The object qualifier and parts of the DrawLine method syntax are described in the following table.

Part Description
object Optional. Object expression that evaluates to an object. If object is omitted, the Form with the focus is assumed to be object.
(x1, y1) Optional. Single values indicating the coordinates of the starting point for the line or rectangle. The ScaleMode property determines the unit of measure used. If omitted, the line begins at the position indicated by CurrentX and CurrentY.
(x2, y2) Required. Single values indicating the coordinates of the end point for the line being drawn.
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 to specify the color.
vbLineBox Optional. Numeral 1. If included, causes a box to be drawn using the coordinates to specify opposite corners of the box.
vbLineBoxFill Optional. Numeral 2. If the vbLineBox option is used, the vbLineBoxFill option specifies that the box is filled with the same color used to draw the box. You cannot use vbLineBoxFill without vbLineBox. If vbLineBoxFill is used without vbLineBox, the box is filled with the current FillColor and FillStyle. The default value for FillStyle is transparent.

Remarks

To draw connected lines, begin a subsequent line at the end point of the previous line.

The width of the line drawn depends on the setting of the DrawWidth property. The way a line or box is drawn on the background depends on the setting of the DrawMode and DrawStyle properties.

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