asp.net GDI+绘制多个矩形

时间:2021-03-15 20:47:03
 using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Drawing.Drawing2D; public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Bitmap bitmap = new Bitmap(, );
Graphics graphics = Graphics.FromImage(bitmap);
graphics.Clear(Color.White);
Pen pen = new Pen(Color.Blue, );
Rectangle[] rects = { new Rectangle(, , , ), new Rectangle(, , , ), new Rectangle(, , , ) };
graphics.DrawRectangles(pen, rects);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
Response.ClearContent();
Response.ContentType = "image/Jpeg";
Response.BinaryWrite(ms.ToArray());
}
}

asp.net GDI+绘制多个矩形