//先添加Form1_Paint事件 private void Form1_Paint(object sender, PaintEventArgs e) { int x, y; x = y = 100;//偏移值; Graphics gr = e.Graphics; Pen p1 = new Pen(Color.Red, 2); Point[] pt = { new Point(0+x,76+y), new Point(80+x,76+y), new Point(106+x,0+y), new Point(130+x, 76+y), new Point(210+x, 76+y), new Point(146+x, 124+y), new Point(170+x,200+y), new Point(106+x,152+y), new Point(40+x,200+y), new Point(66+x,124+y)}; gr.DrawPolygon(p1, pt);//绘制多边形 gr.Dispose(); p1.Dispose(); }
运行结果: