我的应用程序将点保存在一个数组中,然后调用System.Drawing.Graphic.DrawLines(Pen, Point[])
以绘制连接这些点的线。它有效,但绘图线似乎总是在数组的第一个点和表单的左上角之间放置一条额外的线。
好的,等一下,我把样品弄得一团糟,尽快修复
代码示例:
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);
}
有问题的图片