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 Drom : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int width = 430, hight = 240;
        Bitmap image = new Bitmap(width, hight);
        Graphics g = Graphics.FromImage(image);  //创建画布
        g.Clear(Color.Wheat );  //清空背景色
        Random random = new Random();
        for (int i = 0; i < 5000; i++)
        {
            int x = random.Next(image.Width);
            int y = random.Next(image.Height);
            image.SetPixel(x, y, Color.FromArgb(random.Next()));
        }
        g.DrawRectangle(new Pen(Color.YellowGreen ,5), 0, 0, image.Width - 2, image.Height - 2);

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

    }
}
