繪製多邊形
阿新 • • 發佈:2019-01-11
實現效果
知識運用:
Graphics類的DrawPolygon (Pen pen,Point[] points) //繪製由一組Point結構定義的多邊形
實現程式碼:
private void button1_Click(object sender, EventArgs e) { Graphics graphics = this.CreateGraphics(); Pen myPen = new Pen(Color.Black,3); Point pt1 = new Point(80,150); Point pt2 = new Point(120, 20); Point pt3 = new Point(240, 20); Point pt4 = new Point(280,150); Point pt5 = new Point(140,240); Point[] myPoints = { pt1,pt2,pt3,pt4,pt5}; graphics.DrawPolygon(myPen,myPoints); }