我使用以下方法将图像加载到Picture Box中:
picturebox1.Image = Image.FromFile()
Run Code Online (Sandbox Code Playgroud)
我用以下方法保存它:
Bitmap bm = new Bitmap(pictureBox1.Image);
bm.Save(FileName, ImageFormat.Bmp);
Run Code Online (Sandbox Code Playgroud)
它在创建新文件时工作得很好,但是当我尝试替换现有图像时,我会抛出以下运行时错误:
GDI +中发生了一般错误
那么我该怎么做才能解决这个问题呢?