Converting an Image to an Icon
-
Basically, i want to know if there is a way to convert an Image to an Icon in C#. I tried the Icon constructor which accepts a Stream object and a Memory stream accepts a byte[], but i wasnt sure how to convert an Image to a byte[]. I am loading a .png file into memory to show a status, but i also have to show the same image in the form's icon and i dont want to have a .ico and a .png file for every status. Thanks for the help.
-
Basically, i want to know if there is a way to convert an Image to an Icon in C#. I tried the Icon constructor which accepts a Stream object and a Memory stream accepts a byte[], but i wasnt sure how to convert an Image to a byte[]. I am loading a .png file into memory to show a status, but i also have to show the same image in the form's icon and i dont want to have a .ico and a .png file for every status. Thanks for the help.
Why don't you load an icon and convert it to a bitmap? Icon.ToBitmap does it. (Don't know how to do it the other way round...)