Getting an Icon from an ImageList

Tuesday, April 14, 2009 8:44
Posted in category Uncategorized

If you have added icons to an imagelist in .NET, you might want to retrieve that icon. Yet, the ImageList.Image[n] will return an Image, not an Icon.

If you need the Icon, you can use this code:

Icon i = Icon.FromHandle(((Bitmap)imageList.Images[0]).GetHicon());

That’ll work.

You can leave a response, or trackback from your own site.

Leave a Reply

You must be logged in to post a comment.