现在的位置: 首页 > 综合 > 正文

(C#)GDI+简单绘图画多边形

2013年09月06日 ⁄ 综合 ⁄ 共 602字 ⁄ 字号 评论关闭
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace _10._2._2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            Brush brush = new SolidBrush(Color.Yellow);
            Pen pen = new Pen(Color.Green,8);
            Point[] points1 =
            {
                new Point(10,90),
                new Point(40,300),
                new Point(200,78)
            };
            g.DrawPolygon(pen, points1);
            Point[] points2 =
            {
                new Point(110,90),
                new Point(140,300),
                new Point(300,78)
            };
            g.FillPolygon(brush, points2);
        }
    }
}

利用Point数组画图。

抱歉!评论已关闭.