How to extract an icon from a multi icons .ico file (icon set) c#

While you are developing for windows, you may occasionally have to deal with problems related to old implementations.

In the past, developers made large use of .ico files and sometimes a .ico file contained a set of icons.

If you have to face front this problem, don't worry! There is a C# class to make you happy!.

As defined by Microsoft, IconBitmapDecoder Class defines a specialized decoder for icon (.ico) encoded images.

csharp
    
Imagine you have a .ico files containing 10 icons, and you want to get the image number 6. With a few lines of code you'll solve your problem

 

Looping inside images


To loop inside the images (and put them in a wrappanel) you can use the foreach statement, like the following:

        
Gg1

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.