Draw a line on the Canvas.
Syntax

[C#]

XRect DrawLine(IEnumerable<double> inPointCoords, DrawOptions inOptions);
XRect DrawLine(IEnumerable<XPoint> inPoints, DrawOptions inOptions);

[Visual Basic]

Function DrawLine(inPointCoords As IEnumerable(Of Double), inOptions As DrawOptions) As XRect
Function DrawLine(inPoints As IEnumerable(Of XPoint), inOptions As DrawOptions) As XRect
Params
Name Description
inPointCoords The line point coordinates.
inOptions The draw options.
inPoints The line points.
return The drawn area.
Notes

Draw the line identified by the points or point coordinates using the properties specified by DrawOptions.

See Also

DrawOptions

Example

Here we draw a line.

[C#]XPoint[] points = new XPoint[] {
  new XPoint(30, 190),
  new XPoint(100, 10),
  new XPoint(170, 190),
  new XPoint(10, 70),
  new XPoint(190, 70)};
Canvas canvas = new Canvas(300, 300, new XColor(Color.Yellow));
DrawOptions drawOpts = new DrawOptions(canvas);
drawOpts.PenColor = new XColor(Color.Blue);
canvas.DrawLine(points, drawOpts);
canvas.SaveAs(Server.MapPath("Canvas_DrawLine_91.png"));


[Visual Basic]Dim points As XPoint() = New XPoint() {New XPoint(30, 190), New XPoint(100, 10), New XPoint(170, 190), New XPoint(10, 70), New XPoint(190, 70)}
Dim canvas As New Canvas(300, 300, New XColor(Color.Yellow))
Dim drawOpts As New DrawOptions(canvas)
drawOpts.PenColor = New XColor(Color.Blue)
canvas.DrawLine(points, drawOpts)
canvas.SaveAs(Server.MapPath("Canvas_DrawLine_91.png"))



Canvas_DrawLine_91.png