建筑水暖图例大全:ASP.NET的一个小问题

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/28 14:00:23
Bitmap image = new Bitmap(50,50);
Graphics g = Graphics.FromImage(image);
Font f = new Font("宋体", 9);
SolidBrush b = new SolidBrush(Color.White);
g.DrawString("Hello",f,b,10,10);

byte[] buffer = new byte[10000];
***
this.Response.BinaryWrite(buffer);
this.Response.End();

中间***的地方应该把 image 转成 buffer,请教这部如何实现,谢谢!
在线等,问题解决有加分!

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