How should I use .ico files in a Winforms Application ?

Posted by Brann on Stack Overflow See other posts from Stack Overflow or by Brann
Published on 2010-03-09T10:04:02Z Indexed on 2010/03/09 10:06 UTC
Read the original article Hit count: 286

Filed under:
|
|
|

I'm developing a WinForms c# 3.0 application. Our designer created quite a lot of .ico files containing all the needed art. The choice of .ico was made because quite often, the same image is needed in several places in different dimensions.

Now, it seems .ico files are really annoying to use in visual studio. The only way to use those images seems to be through images list (which aren't supported by all controls). Compared to other resources, you can't write this :

foo.Image = global::RFQHUB.RFQHUBClient.Properties.Resources.foo; //    Cannot implicitly convert type 'System.Drawing.Icon' to 'System.Drawing.Image'  

Here are the options I'm considering :

  • create ImageLists of all possible sizes referencing all my icons in my main window. Link these ImageLists from other windows and find a way to export Image objects from the ImageList when I can't use it directly ; since ImageList contains a Draw() method, this should probably be possible.
  • convert all the x.ico I've got in several x16.gif ...x48.gif, and use those through resources.

I'd be interested to know if some people have been successfully using .ico resources in a Winform application. In so, how did you set up things ?

© Stack Overflow or respective owner

Related posts about winforms

Related posts about .ico