| | |
Image.FromFile("myfilename.ico") throws "out of memory" exception...why?
Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
![]() |
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();
•
•
•
•
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: 972
Reputation:
Solved Threads: 213
•
•
•
•
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
Views: 1033 | Replies: 5
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access algorithm array barchart bitmap box button buttons c# chat check checkbox class client code color combobox control conversion csharp custom database datagridview dataset datetime degrees draganddrop drawing encryption enum excel file files form format forms ftp function gdi+ httpwebrequest image index input install java label list listbox listener login mandelbrot math mouseclick mysql networking object operator oracle path photoshop picturebox pixelinversion post prime programming radians regex remote remoting resource richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






