且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何解决winforms错误"GDI +中发生了一般性错误. " ;?

更新时间:2022-12-09 19:52:50

我最近也有同样的例外.实际上,我遇到的问题是程序试图将文件写入不存在的文件夹.该文件是从应用程序创建的gif.
现在您不会猜测,但是我创建了文件夹,一切正常.谁会认为通用GDI +异常确实与IO相关? :)
无论如何,经过一番谷歌搜索后,我发现更多的人遇到了这个问题.
解决"GDI +异常中发生一般错误 [搜索结果 [ ^ ]将有所帮助.
异常的问题在于它无法告诉您任何信息(我实际上认为这是代码缺陷,甚至是框架中的错误),因此您什么也不能告诉我们.因此,寻求帮助很困难.
无论如何,请检查代码是否需要(写入)对某些文件或文件夹的访问权,并确保文件或文件夹存在并且您具有写权限.
祝您有个含糊的例外!!
希望对您有所帮助:)
I recently had that same exception. Actually the problem I had was that a program was trying to write a file to a folder that didn''t exist. The file was a gif created from the application.
Now you wouldn''t guess, but I created the folder and everything went fine. Who would think a Generic GDI+ Exception would really be IO related? :)
Anyway, after Googling a bit I found more people have this problem.
Solving "A Generic Error Occurred In GDI+" Exception[^]
Perhaps one of these search results[^] will help.
The problem with this Exception is that it tells you nothing (I actually think this is a code flaw or even bug in the framework) and you can''t tell us anything as a result. So finding help is difficult.
Anyway, check if your code needs (write) access to some files or folders and make sure the file or folder exists and that you have permission to write.
Good luck with this vague Exception!
Hope it helps :)