DrawLine (PictureBox)

This method draws lines and rectangles on a PictureBox control.

Syntax

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

Parameters

picturebox
Reference to a PictureBox control.
x1
Required. Horizontal coordinate of the starting point for a line or rectangle.
y1
Required. Vertical coordinate of the starting point for a line or rectangle.
x2
Required. Horizontal coordinate of the end point for a line or rectangle.
y2
Required. Vertical coordinate of the end point for a line or rectangle.
color
Optional. Value that indicates the RGB color used to draw a line. If omitted, the ForeColor property setting is used.
box
Optional boolean. If box is true, a box is drawn using the coordinates to specify opposite corners of the box. If box is false, a line is drawn. Default value is FALSE.
fill
Optional boolean. If fill is true, the box is filled with the same color used to draw the box. If fill is false, the box is filled with the current fillcolor and fillstyle. The default value for the fill parameter is false.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.

Return Value

None.

Remarks

The ScaleMode property determines the unit of measure used. The setting of the DrawWidth property determines the width of the line.