drawline加上多边形的坐标也可以吧。
//===============1种===================
全局:
Queue
鼠标弹起事件:
if (e.Button == MouseButtons.Left)
{
PointArray.Enqueue(new Point(e.X, e.Y)); //记录点
}
else
{
this.CreateGraphics().DrawPolygon(new Pen(Color.Red), PointArray.ToArray() );//绘制矩形,this是窗体
PointArray.Clear();
}
//=====================================
//===============2种===================
Point point1 = new Point(100, 200);
Point point2 = new Point(100, 300);
Point point3 = new Point(200, 300);
Point point4 = new Point(200, 200);
Point[] curvePoints =
{ point1, point2, point3, point4, }; //定义点数组,这个可以通过鼠标画点得到,也可以指定固定的点
System.Drawing.SolidBrush myBrush2 = new System.Drawing.SolidBrush(System.Drawing.Color.Blue); //定义一个brush
formGraphics.FillPolygon(myBrush2, curvePoints);//绘图
myBrush2.Dispose();
formGraphics.Dispose(); //销毁对象
//=====================================
DrawPolygon 方法