GDI+ 发生一般性错误
求帮忙!该怎么改?程序代码:
for (int i = 0; i < barCodeArray.Length; i++) { string barCode = barCodeArray[i]; Code39 _Code39 = new Code39(); _Code39.Height = 45; _Code39.Magnify = 0; _Code39.ViewFont = new Font("宋体", 10); System.Drawing.Image _CodeImage = _Code39.GetCodeImage(barCode, Code39.Code39Model.Code39Normal, true); _Stream = new (); // _CodeImage.Save(_Stream, System.Drawing.Imaging.ImageFormat.Jpeg); System.Drawing.Bitmap _newImage = new Bitmap(_CodeImage.Width, _CodeImage.Height); Graphics copy = Graphics.FromImage(_newImage); copy.DrawImage(_CodeImage, 0, 0); string p = Server.MapPath("BarCode"); string n = Guid.NewGuid().ToString(); string saveUrl = p + "/" + n + ".jpeg"; _CodeImage.Dispose(); _Stream.Close(); _newImage.Save(saveUrl); //GDI+ 发生一般性错误 _newImage.Dispose(); System.Web.UI.WebControls.Image webImg = new System.Web.UI.WebControls.Image(); webImg.Height = _CodeImage.Height; webImg.Width = _CodeImage.Width; webImg.ImageUrl = "BarCode/" + n + ".jpeg"; //webImg.ImageUrl = "BarCode/" + n + ".png"; TableRow tabRow = new TableRow(); table.Rows.Add(tabRow); TableCell imgCell = new TableCell(); imgCell.Controls.Add(webImg); tabRow.Cells.Add(imgCell); } this.Controls.Add(table);