DrawLine (PictureBox)

Draws lines and rectangles on an object.

Syntax

object.DrawLine x1, y1, x2, y2, [color], [box], [fill]

The parts and object qualifier 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 Required. Values indicating the coordinates of the starting point for the line or rectangle. The ScaleMode property determines the unit of measure used.
x2, y2 Required. 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 or to specify the color.
box Optional. If included, causes a box to be drawn using the coordinates to specify opposite corners of the box.
fill Optional. If the box option is used, the fill option specifies that the box is filled with the same color used to draw the box. You cannot use fill without box. If box is used without fill, 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.