/// <summary> /// 画多边形的最后一条边 /// </summary> /// <param name="color">当前边的颜色</param> /// <param name="name">名称</param> /// <return>true:成功构成多边形; false:多边形自相交或顶点过少</return> public bool drawLastEdge(Color color, string name) { if (curPolygon.nVertex >= 3) { if (curPolygon.isSelfIntersect() == true) { MessageBox.Show("多边形自相交!"); return(false); } else { Point v1 = curPolygon.getLast(); Point v2 = curPolygon.getFirst(); curPolygon.changeVertexOrder(); drawLine_Bresenham(v1, v2, color); curPolygon.Name = name; listPolygon.AddLast(curPolygon); return(true); } } else { MessageBox.Show("顶点数不足3个,无法构成多边形!"); return(false); } }