using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using System.Drawing;
public partial class Dpoly : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int width = 420, hight = 250;
        Bitmap image = new Bitmap(width, hight);
        Graphics g = Graphics.FromImage(image);  //创建画布
        g.Clear(Color.YellowGreen);   //清空背景色
        Pen pen1 = new Pen(Color.Blue, 1);  //创建画笔对象
        Pen pen2 = new Pen(Color.Red, 4);
        Point[] points = new Point[6];
        points[0].X = 180; points[0].Y = 60;
        points[1].X = 130; points[1].Y = 80;
        points[2].X = 180; points[2].Y = 100;
        points[3].X = 130; points[3].Y = 100;
        points[4].X = 180; points[4].Y = 80;
        points[5].X = 130; points[5].Y = 60;
        g.DrawPolygon(pen1, points);  //绘制多边形
        Point[] mypoints = new Point[6];
        mypoints[0].X = 300; mypoints[0].Y = 130;
        mypoints[1].X = 80; mypoints[1].Y = 150;
        mypoints[2].X = 30; mypoints[2].Y = 240;
        mypoints[3].X = 350; mypoints[3].Y = 240;
        mypoints[4].X = 400; mypoints[4].Y = 150;
        mypoints[5].X = 350; mypoints[5].Y = 130;
        g.DrawPolygon(pen2, mypoints);  //绘制多边形

        System.IO.MemoryStream ms = new System.IO.MemoryStream();
        image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
        Response.ClearContent();
        Response.ContentType = "image/Gif";
        Response.BinaryWrite(ms.ToArray());
    }
}
