如何将现有的位图绘制到Web窗体. [英] How to Draw an Existing Bitmap to a Web form.
本文介绍了如何将现有的位图绘制到Web窗体.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
byte[] im = (byte[])dt.Rows[0]["Photo"];
Bitmap Image = new Bitmap(new MemoryStream(im));
我可以使用
以字节为单位绘制它
I can draw it in bytes using
Response.ContentType = path;
Response.BinaryWrite(im);
但是我想对Bitmap进行同样的操作.
But i want to do the same with Bitmap .
推荐答案
如果您想做我想做的事,请尝试一下:
If you want to do what I think, give this a try:
Response.Clear();
Response.ContentType = "image/bmp";
byte[] im = (byte[])dt.Rows[0]["Photo"];
bm Image = new Bitmap(new MemoryStream(im));
bm.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Bmp)
清理内存时要小心.
Be careful about cleaning up your memory.
这篇关于如何将现有的位图绘制到Web窗体.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文