Bitmap.FromFile generates Out Of Memory with some icons!!

  • Thread starter Thread starter Dana
  • Start date Start date
D

Dana

I tried loading an icon to an imageList using the following method:

Image cc = Bitmap.FromFile("C:\\myicon.ico");
imageList1.Images.Add(cc);

It works with some icons but generates an "Out of Memory" error with some
others. The strange thing is that when I try to add the icon manually to the
imageList, it adds it without problems!!

One of the icons that generates this problem is:

http://www.telegraph.co.uk/favicon.ico

Can anyone help?
 
Dana said:
I tried loading an icon to an imageList using the following method:

Image cc = Bitmap.FromFile("C:\\myicon.ico");
imageList1.Images.Add(cc);

It works with some icons but generates an "Out of Memory" error with some
others. The strange thing is that when I try to add the icon manually to
the imageList, it adds it without problems!!

One of the icons that generates this problem is:

http://www.telegraph.co.uk/favicon.ico

Can anyone help?


favicon.ico is in a format not supported by the framework (and GDI+), OOM
exceptions are thrown when trying to load an invalid or non supported format
BitMap file, try to save the file in a supported format.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top