我需要能够使用鼠标点击位置绘制多边形。 这里是我当前的代码:在C中使用鼠标点绘制多边形#
//the drawshape varible is called when a button is pressed to select use of this tool
if (DrawShape == 4)
{
Point[] pp = new Point[3];
pp[0] = new Point(e.Location.X, e.Location.Y);
pp[1] = new Point(e.Location.X, e.Location.Y);
pp[2] = new Point(e.Location.X, e.Location.Y);
Graphics G = this.CreateGraphics();
G.DrawPolygon(Pens.Black, pp);
}
感谢
我假设你在winforms上。你提供的代码,但它的工作?你的问题是什么? – 2010-10-21 14:00:19
是的,是的,它是行不通的,我可以;吨工作了如何存储鼠标点击阵列中,他们被加入一条线,就像在MS漆 – 2010-10-21 14:02:11
用户应该如何绘制一个多边形?一行一行,或整个多边形一次?您希望用户左键单击点数x次,然后右键单击绘制(否则,您如何知道用户何时完成)? – 2010-10-21 14:18:27