“A generic error occurred in GDI+” when attempting to use Image.Save

后端 未结 6 1045
挽巷
挽巷 2020-12-11 06:21

I am developing an Outlook 2010 Add-In, and am loading an image from a serialized XML file. The image loads fine, and am able to assign it to a pictureBox object on a Winfo

6条回答
  •  情话喂你
    2020-12-11 07:07

    In my case it was a spelling mistake in the path to the directory where I was saving the image:

    if (Directory.Exists(directory_path))
    {
     image.SaveAs(directory_path + filename);
    }
    

    As gaffleck said it would be nice if GDI+ had thrown more informative exception.

提交回复
热议问题