Bitmap newBitmap = new Bitmap(600,400);
Graphics g = Graphics.FromImage(newBitmap);
g.DrawLine(System.Drawing.Pens.Blue,new Point(50,50),new Point(10,10));
g.DrawLine(System.Drawing.Pens.Red,new Point(50,50),new Point(120,120));
newBitmap.Save("c:\\TestImage.bmp", System.Drawing.Imaging.ImageFormat.Bmp) ;
Graphics g = Graphics.FromImage(newBitmap);
g.DrawLine(System.Drawing.Pens.Blue,new Point(50,50),new Point(10,10));
g.DrawLine(System.Drawing.Pens.Red,new Point(50,50),new Point(120,120));
newBitmap.Save("c:\\TestImage.bmp", System.Drawing.Imaging.ImageFormat.Bmp) ;
应该有异常的提示吧,可以贴出来给大家看看,这样也好知道是什么问题。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Runtime.InteropServices.ExternalException: GDI+ 中发生一般性错误。源错误:
行 101: g.DrawLine(System.Drawing.Pens.Blue,new Point(50,50),new Point(10,10));
行 102: g.DrawLine(System.Drawing.Pens.Red,new Point(50,50),new Point(120,120));
行 103: newBitmap.Save("c:\\zxgPic\\TestImage.bmp", System.Drawing.Imaging.ImageFormat.Bmp) ;
行 104:
行 105: }
源文件: c:\inetpub\wwwroot\webapplication1\webform1.aspx.cs 行: 103 我把C盘的文件夹zxgPic设为可写,也不幸,各位在看看,谢谢了 ....