Can not Construct Icon From stream.

S

steel

I now get a 'NotSupportedException' when using the Icon constructor
that takes a Stream.

Here is the C# code that is used.

//Img = new Icon( System.IO.File.Open( "\\first.ico",
System.IO.FileMode.Open ) );

Stream stream =
System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("FMRS.Images.icon_first.ico");

Icon icon = new Icon(stream);
imgListReading.Images.Add(icon);

I have checked that the stream is not null.

This is the error I get...

An unhandled exception of type 'System.NotSupportedException' occurred
in System.Drawing.dll

Additional information: NotSupportedException
 

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

Top