Graphics.DrawLine

DrawLine(Pen, Point, Point)

Draws a line connecting two Point structures.

public void DrawLine(Pen pen, Point point1, Point point2)
ParameterTypeDescription
penPenPen that determines the color, width, and style of the line.
point1PointPoint structure that represents the first point to connect.
point2PointPoint structure that represents the second point to connect.

Exceptions

exceptioncondition
ArgumentNullExceptionpen is null.

See Also


DrawLine(Pen, PointF, PointF)

Draws a line connecting two PointF structures.

public void DrawLine(Pen pen, PointF point1, PointF point2)
ParameterTypeDescription
penPenPen that determines the color, width, and style of the line.
point1PointFPointF structure that represents the first point to connect.
point2PointFPointF structure that represents the second point to connect.

Exceptions

exceptioncondition
ArgumentNullExceptionpen is null.

See Also


DrawLine(Pen, int, int, int, int)

Draws a line connecting the two points specified by the coordinate pairs.

public void DrawLine(Pen pen, int x1, int y1, int x2, int y2)
ParameterTypeDescription
penPenPen that determines the color, width, and style of the line.
x1Int32The x-coordinate of the first point.
y1Int32The y-coordinate of the first point.
x2Int32The x-coordinate of the second point.
y2Int32The y-coordinate of the second point.

Exceptions

exceptioncondition
ArgumentNullExceptionpen is null.

See Also


DrawLine(Pen, float, float, float, float)

Draws a line connecting the two points specified by the coordinate pairs.

public void DrawLine(Pen pen, float x1, float y1, float x2, float y2)
ParameterTypeDescription
penPenPen that determines the color, width, and style of the line.
x1SingleThe x-coordinate of the first point.
y1SingleThe y-coordinate of the first point.
x2SingleThe x-coordinate of the second point.
y2SingleThe y-coordinate of the second point.

Exceptions

exceptioncondition
ArgumentNullExceptionpen is null.

See Also