| | |
Image.FromFile("myfilename.ico") throws "out of memory" exception...why?
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
It seems this method doesn't support ico file. I tried with .bmp files, its working fine.
Freedom in the Mind, Faith in the words.. Pride in our Souls...
Indian Developer
http://falaque.wordpress.com/
Indian Developer
http://falaque.wordpress.com/
Icon class is there.
c# Syntax (Toggle Plain Text)
System.Drawing.Icon c = new Icon(@"c:\app\mapp\p1.ico"); pictureBox1.Image = c.ToBitmap();
Failure is not fatal, but failure to change might be. - John Wooden
•
•
•
•
Are you sure this method doesn't support ico files? I haven't seen that claim anywhere until now. Sure would be helpful to know for sure.
Freedom in the Mind, Faith in the words.. Pride in our Souls...
Indian Developer
http://falaque.wordpress.com/
Indian Developer
http://falaque.wordpress.com/
•
•
Join Date: Jul 2009
Posts: 920
Reputation:
Solved Threads: 147
•
•
•
•
Icon class is there.
c# Syntax (Toggle Plain Text)
System.Drawing.Icon c = new Icon(@"c:\app\mapp\p1.ico"); pictureBox1.Image = c.ToBitmap();
I don't understand why the Bitmap object initialization works from the file OK in this case, but not from my stream:
C# Syntax (Toggle Plain Text)
MemoryStream ms = new MemoryStream(webClient.DownloadData(uriIcon)); Bitmap bmp = new Bitmap(ms); // throws exception
This failure (ParameterInvalid exception) only occurs with certain icons I test, which is why I provided the sample. How can I convert this icon directly from my stream to a bitmap without having to save it to a file first?
Thanks,
David
![]() |
Similar Threads
- How to "delete" this memory??? (C++)
- google "keyword" question (Search Engine Optimization)
- display image if applet is "not inited" (Java)
- error with win2k, memory could not be "read" (Windows NT / 2000 / XP)
- "MiCr0s0ft.exe", "Microsoftx.exe" & "ns.exe" viruses?Please Help (Viruses, Spyware and other Nasties)
Other Threads in the C# Forum
- Previous Thread: Parameter is Invalid exception retrieving favicon.ico
- Next Thread: C# parsing with XML
| Thread Tools | Search this Thread |
.net access ado.net algorithm array barchart bitmap box broadcast buttons c# check checkbox client color combobox control conversion cryptographyc#winformsencryption csharp custom database datagrid datagridview dataset datetime degrees development draganddrop drawing encryption enum event excel file files form format forms function gdi+ hash httpwebrequest image index input install java keypress label list listbox listener mandelbrot math mouseclick mysql netcfsvcutil.exe operator path photoshop picturebox pixelinversion pixelminversion post programming radians regex remote remoting richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer update upload usercontrol validate validation view visualstudio webbrowser windows winforms wpf xml






