Zac
Zac

Reputation: 2373

icon to byte [] C# compact framework

I've looked around for an answer to this for quite some time.

I need to convert an icon to a byte[] in .NETCF but there is no icon.save() function in compact framework to create a MemoryStream object. What is another way that I can do this?

Thanks

Upvotes: 2

Views: 526

Answers (3)

Jonas Van der Aa
Jonas Van der Aa

Reputation: 1461

There's two things I can think of, one of them is suggested by Christian, the other one is that if it is a resource, can't you get a ResourceStream? This works if you make the icon an Embedded Resource (example found here)

This SO thread also discusses something not unlike your problem.

Upvotes: 2

Christian Resma Helle
Christian Resma Helle

Reputation: 746

If all you need is the raw bytes of the .Ico file then you can just read it directly with a file stream

Upvotes: 1

Hulk
Hulk

Reputation: 11

Is it possible to call Icon.ToBitmap() and then read the bytes from the bitmap?

Upvotes: 1

Related Questions