A Generic error occurs at GDI+ at Bitmap.Save() after using SaveFileDialog

前端 未结 12 1545
情书的邮戳
情书的邮戳 2020-12-10 01:07

I use the following code block with some more code inside the using block:

using (System.Drawing.Bitmap tempImg =
       (System.Drawing.Bitmap)tempObj.GetDa         


        
12条回答
  •  悲哀的现实
    2020-12-10 01:35

    Finally I could find what was wrong in my code and would like to mention it here as I think it may be useful to someone....

    As I have given a relative path in tempImg.Save, and after the user clicks 'Save' in SaveFileDialog, the actual path for tempImg.Save become :

    Path specified by SaveFileDialog + the relative path

    automatically.

    Thus if the path does not exist, this error occurs.

    Thanks every one for the answers.

提交回复
热议问题