GDI 中发生一般错误加载时
我在从 File() 加载图像时收到“GDI+ 中发生一般错误”。 这发生在一些图像上。
我尝试了很多方法来修复这个错误,但都无济于事。
通过谷歌我发现很多人在保存文件时遇到这个问题。当我尝试加载它时我得到它。
我所做的就是:
图像= System.Drawing.Image.FromFile(@"C:\pic.jpeg");
从文件加载图像时有人修复了此错误吗?
im receiving "A generic error occurred in GDI+" while loading an image FromFile().
this happens on a few images.
I tried numerous of things to fix this error, but to no avail.
via google i found out a lot of people having this issue when they save the file. i get it when i try to load it.
all i do is:
image =
System.Drawing.Image.FromFile(@"C:\pic.jpeg");
anyone fixed this error when loading an image from file?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您遇到的问题是该文件已打开。也许您通过将其放入
PictureBox
中来打开它,或者您已经打开了它?您应该查看是否使用 Unlocker 打开它。
当文件已在位图中打开时,我收到此错误。请务必在使用每个 Bitmap 对象后
Dispose
。The problem you're encountering is that the file is already open. Maybe you opened it by putting it into a
PictureBox
, or you opened it already?You should see if its opened by using Unlocker.
I got this error when having the file open in a
Bitmap
already. Be sure toDispose
every Bitmap object after using it.