My application saves points in an array and then calls System.Drawing.Graphic.DrawLines(Pen, Point[]) to draw the lines connecting the points. It works, but drawlines always seems to place an extra line between the first point of the array and the upper left corner of the form.
ok wait a sec, i did a mess with the samples, fixing it as soon as possible
Code sample:
Pen black = new Pen(Color.black, 2);
MyGraphicObject = Graphics.FromImage(picture);
Point[] linee = new Point[5];
public void check (int a, int b)
{
linee[0].X = (b) * 30 + 13;
linee[0].Y = (a-1) * 30 + 13;
linee[1].X = (b+1) * 30 + 13;
linee[1].Y = (a) * 30 + 13;
linee[2].X = (b) * 30 + 13;
linee[2].Y = (a+1) * 30 + 13;
linee[3].X = (b-1) * 30 + 13;
linee[3].Y = (a) * 30 + 13;
linee[4].X = (b) * 30 + 13;
linee[4].Y = (a-1) * 30 + 13;
MyGraphicObject.DrawLines(black, linee);
}
Image with the problem

Graphics.DrawLines method:
I think you have one extra point either at beginning or at the end of array, which is initialized with default value. Possible reason – you create array of points which has N+1 length (where N is points number). And you don’t provide X and Y for first or last point. Thus it stays with default
X = 0, Y = 0