using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Drawing; namespace BitMap { /// <summary> /// Image 的摘要说明 /// </summary> public class Image : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/jpeg"; //画板 using (Bitmap bitMap = new Bitmap(100, 100)) { //画笔 using (Graphics g = Graphics.FromImage(bitMap)) { g.DrawString("Cupid", new Font("微软雅黑", 20), Brushes.Blue, new Point(10, 5)); bitMap.Save(context.Response.OutputStream,System.Drawing.Imaging.ImageFormat.Jpeg); } } } public bool IsReusable { get { return false; } } } }
原文:http://www.cnblogs.com/alphafly/p/3815738.html