[已解决问题] "Out of Memory" exception
提问时间: 2008-03-18 11:00
悬赏分:100 浏览:405 次
I got "Out of memory" exception when load an ".ico" file use System.Drawing.Image.FromFile,
Image.FromFile(sFilePath, true);
but don't get any exception when load a ".jpg" file, and there are same permission settings for these files. I found a post which said the exception caused by it doesn't have sufficient permission. :(

And I still got "Paramter is not vaild" exception when load the ico use Image.FromStream.
FileStream fs = new FileStream(sFilePath, FileMode.Open, FileAccess.Read);
Image img 
= Image.FromStream(fs, truetrue);
I'm confused, the codes seem work on another PC. :(

Who knows what am i doing wrong?
提问者:蒜头 - 初学一级
所有回答(3)
I've met a similiar problem, I can load a jpg file, but can't save it to file, or there is a "OutOfMemoryException". What I suggest you to do is to check if the ".ico" file is valid, open it with other software.
6个月前   回答者:deerchao - 大侠五级
Maybe you can try to use Icon.ctor(string) to load this file to an Icon instance. Than use Bitmap.ctor(Icon) to convert the object to an Image object.
6个月前   回答者:Colin Han - 老鸟四级
楼上的好厉害, 都是E文 啊~~~ 直接用ICon 类试试呢?
6个月前   回答者:G yc {Son of VB} - 菜鸟二级
评论
   您需要登录以后才能回答!
 

我要提问

我的问题


快到期问题

> 问题排行榜

相关内容

相关链接