// Brush图片
string brushfile = Server.MapPath("~/logo.gif");
// 被填充的图片
string file = Server.MapPath("~/Element.jpg");
// 声明TextureBrush对象
System.Drawing.Image brushimg = System.Drawing.Image.FromFile(brushfile);
System.Drawing.TextureBrush texture = new System.Drawing.TextureBrush(brushimg);
texture.WrapMode = System.Drawing.Drawing2D.WrapMode.Tile;
System.Drawing.Image img = System.Drawing.Image.FromFile(file);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(img); // 创建Graphics对象
g.FillEllipse(texture, new System.Drawing.RectangleF(90.0f,110.0f,100,100)); // 用图形填充
g.Dispose();
// 将图形加载到Response中
img.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
如上代码,在IE浏览器里能显示出来,可是在非IE浏览器就出现一大堆的乱码,请问应该怎么解决?代码是从书<ASP.NET3.5从入门到精通>上面抄的...
Response.ContentType = "image/JPEG";
在Save之前加这一句试试?