码迷,mamicode.com
首页 > 其他好文 > 详细

绘制多边形

时间:2019-01-11 23:19:33      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:obj   point   src   inf   alt   bubuko   分享   技术   []   

实现效果

  技术分享图片

知识运用:

  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);
        }

  

绘制多边形

标签:obj   point   src   inf   alt   bubuko   分享   技术   []   

原文地址:https://www.cnblogs.com/feiyucha/p/10257654.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!