Graphics.DrawLines() throw a exception System.ArgumentException: 'Parameter is not valid.' at the runtime

0

When I draw a line with points and I checked length of points > 2:

gh.DrawLines(pen, points);

My pen

Pen pen = new Pen(Color.Red,1);

My points

(200,200)
(100,500)
(200,500)

But when I run then it throw a exception as below:

System.ArgumentException
  HResult=0x80070057
  Message=Parameter is not valid.
  Source=System.Drawing
  StackTrace:
   at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
   at System.Drawing.Graphics.DrawLines(Pen pen, PointF[] points)
   at CWD.Service.DrawHelper.DrawLayer.DrawLineLayerAsync(Graphics gh, Pen pen, PointF[] points) in D:\workings\repositories\control-work-draw\CWD\CWD.Service\DrawHelper\DrawLayer.cs:line 11
   at CWD.Service.DrawHelper.DrawFile.<>c__DisplayClass3_0.<ExecuteLineAsync>b__0() in D:\workings\repositories\control-work-draw\CWD\CWD.Service\DrawHelper\DrawFile.cs:line 67
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
c#
winforms
draw2d

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0