提示“名称response未声明”

解决方案 »

  1.   

    try System.Web.HttpContext.Current.Response.OutputStreambut you may want to redesign your code, so that, your method will be passed a Stream objectvoid YourMethod(Stream m)
    {
      ///....
      objBitmap.Save(m, System.Drawing.Imaging.ImageFormat.Jpeg) 
    }then in your ASP.NET, you will callYourMethod(Response.OutputStream);
      

  2.   

    http://msdn.microsoft.com/msdnmag/issues/02/02/aspdraw/
      

  3.   

    DataRow dr = GetLogoInfo(LogoFileID);//根据传入id读取数据库
    if (dr != null)
    {
    string fileType = dr["LogoFileType"].ToString();//图片类型
    System.Web.HttpContext.Current.Response.ContentType = "image/"+fileType;
    System.Drawing.Image _image = System.Drawing.Image.FromStream( new System.IO.MemoryStream( (byte[])dr["LogoFile"] ) );//dr["LogoFile"]是图片信息
    switch (fileType)
    {
    case "jpg":
    _image.Save( System.Web.HttpContext.Current.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg );
    break;
    case "bmp":
    _image.Save( System.Web.HttpContext.Current.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Bmp );
    break;
    case "gif":
    _image.Save( System.Web.HttpContext.Current.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif );
    break;
    case "png":
    _image.Save( System.Web.HttpContext.Current.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png );
    break;
    }                    
    }