Search code examples
c#.netimageiconssystem.drawing

how can I convert System.Drawing.Icon to System.Drawing.Image?


I'm getting icon from another application using this:

Icon IEIcon =  Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe");

how to convert it to System.Drawing.Image?


Solution

  • Description

    The Bitmap is derived from Image so you can use Icon's .ToBitmap() method.

    Sample

    Icon IEIcon = Icon.ExtractAssociatedIcon(@"C:\Program Files\Internet Explorer\iexplore.exe");
    Image im = IEIcon.ToBitmap();
    

    More Information