这样写是没有乱码输出了,但还一个问题:现在这写是可以正常;输出缩略图了,但在只要用这个方法,在输出页面上只能显示一个缩略图而不能再输出其它的东西了,如果我想在一个页面上显示多个缩略图或想让缩略图配合文字输出,应该怎么改呢?public void PubImageSL(string ImagePath,int SLW,int SLH,Page P)
{
//创建上传图片的缩略图
System.Drawing.Image ObjDrImage=System.Drawing.Image.FromFile(ImagePath);
System.Drawing.Bitmap BMP=new System.Drawing.Bitmap(SLW,SLH,PixelFormat.Format16bppRgb555);
System.Drawing.Graphics G=System.Drawing.Graphics.FromImage(BMP);
G.Clear(Color.Transparent);
G.DrawImage(ObjDrImage,new System.Drawing.Rectangle(new System.Drawing.Point(0,0),new System.Drawing.Size(SLW,SLH)),0,0,ObjDrImage.Width,ObjDrImage.Height,System.Drawing.GraphicsUnit.Pixel);
//System.IO.MemoryStream SLStream=new System.IO.MemoryStream();
//BMP.Save(SLStream,System.Drawing.Imaging.ImageFormat.Jpeg);
BMP.Save(P.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
//P.Response.BinaryWrite(SLStream.ToArray());//SLStream.Close();
//SLStream=null;
G.Dispose();
G=null;
BMP.Dispose();
BMP=null;
ObjDrImage.Dispose();
ObjDrImage=null;
                           Response.End(); //此句最重要,你的代码最后加这句也可以不用修改
}

解决方案 »

  1.   

    实际是这样的,输出缩略的页面,在输出到浏览器的时候,已经不是WEB页面了,而是一张图片,所以,改页面只能显示一张单独的图片,其他任何信息都不能有
      

  2.   

    你应该单独作个用于图片的页面 然后在要显示图片的页面 用scr="你显示图片的页面"
      

  3.   

    你只能这样写
    <img src="xxxxx.aspx">
    参见http://dotnet.aspx.cc/ShowDetail.aspx?id=221BC601-1A1B-4E1F-883D-04B043659703