加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

C#编程-131:DrawPolygon绘制多边形

(2017-08-20 13:19:11)
标签:

csharp

分类: 科技

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace PolygonTest
  11. {
  12.     public partial class Form1 Form
  13.     {
  14.         public Form1()
  15.         {
  16.             InitializeComponent();
  17.         }
  18.  
  19.         private void Form1_Paint(object sender, PaintEventArgs e)
  20.         {
  21.             Graphics e.Graphics;
  22.             Pen pen new Pen(Color.Orange,3);
  23.             //绘制三角形
  24.             Point[] points={
  25.                            new Point(220,176),
  26.                            new Point(320,76),
  27.                            new Point(220,76)
  28.                            };
  29.             g.DrawPolygon(pen,points);
  30.             //绘制五角星
  31.             Point[] ps ={
  32.                        new Point(0,76),
  33.                        new Point(80,76),
  34.                        new Point(106,0),
  35.                        new Point(130,76),
  36.                        new Point(210,76),
  37.                        new Point(146,124),
  38.                        new Point(170,200),
  39.                        new Point(106,152),
  40.                        new Point(40,200),
  41.                        new Point(66,124),
  42.                         
  43.                        };
  44.             g.DrawPolygon(pen,ps);
  45.         }
  46.     }
  47. }

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有