为什么一时能成功上存,一时不可以成功上传  
出现错误代码系  A generic error occurred in GDI+.
下面系截图

解决方案 »

  1.   

    是的 public static void StrokeColor(string OriginFilePath, string TargetFilePath, int maxWidth, int maxHeight)
            {
                Bitmap image = new Bitmap(maxWidth, maxHeight);
                Graphics g = Graphics.FromImage(image);            g.Clear(Color.White);            Image orgimg = Image.FromFile(OriginFilePath);  //获取了小图            int x = 0, y = 0;
                if (orgimg.Width < maxWidth)
                {
                    x = (maxWidth - orgimg.Width) / 2;
                }
                if (orgimg.Height < maxHeight)
                {
                    y = (maxHeight - orgimg.Height) / 2;
                }
                g.DrawImage (orgimg, x, y);            g.Dispose();
                if (System.IO.File.Exists(TargetFilePath))
                {
                    System.IO.File.Delete(TargetFilePath);
                }
                image.Save(TargetFilePath);            image.Dispose();            orgimg.Dispose();        }