Converting from Icon to Image

  • Thread starter Thread starter Ron Burd
  • Start date Start date
R

Ron Burd

I have am .ico file attached to the assembly as a Resource. I want to
convert this Icon to an Image object. I was unable to find anything on the
web about such convertion.

I can retrieve the icon using

Icon icon = new Icon(GetType(), "fileName.ICO");

Thanks!
 
Ron,

What you want to do is call the ToBitmap method on the Icon instance,
and it will return an instance of a Bitmap. Since Bitmap derives from
Image, it should suit your needs quite nicely.

Hope this helps.
 
I cannot believe I missed that...Thanks!


Nicholas Paldino said:
Ron,

What you want to do is call the ToBitmap method on the Icon instance,
and it will return an instance of a Bitmap. Since Bitmap derives from
Image, it should suit your needs quite nicely.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Ron Burd said:
I have am .ico file attached to the assembly as a Resource. I want to
convert this Icon to an Image object. I was unable to find anything on the
web about such convertion.

I can retrieve the icon using

Icon icon = new Icon(GetType(), "fileName.ICO");

Thanks!
 
Back
Top