StrataFrame Forum

Best practice for managing application icons...

http://forum.strataframe.net/Topic16307.aspx

By Edhy Rijo - 5/11/2008

Hi,

I am getting an icon collection to use with my .NET projects, and wonder what is the best way to work with the icons, by having an Icon Library or just adding needed icons per form in an imagelist control?

By Keith Chisarik - 5/11/2008

Good question, I have added mine to my project via resource file.
By Trent L. Taylor - 5/11/2008

This can get somewhat complicated as your application gets bigger...and inevitabely you end up adding the same icons to the same application more than once.  So what we try to do is create resource files within the projects that pertain to their purpose versus putting them all in the project resource file.  Also, when you import an image, be sure to set it to Embedded and then delete the icon or image file from teh resources folder (don't worry this is just copied over when added to the project and once embedded, you don't need it).

For example, I will create one icon resource file calle common that will have my Add, edit, delete type of icons that I will use over and over again.  Then when I choose the image on a control (aside from an Image Key, which I will get to) I will choose from the Local resources, choose the Common resource, select the image, and done.  This is also realy nice so if you want to change your Add image down the road....you only have to go to one place.

Next, when using an image control, it is best to programmatically load the control.  This is actually so that the images to not degrade fter a few builds.  If you'll notice, the images will eventually e at a 256 quality (or worse in some cases) if the images are added to the image list through the designer.  It may not show up immediately, but they will eventually start to look bad.  So I generally create a method called LoadImages and jut programmatically loads the images into the control from my resource files ( just one image per line usually).  This way my icons always look crisp and clean....so this will probably be a future SF control so that this won't happen, but for now this is really the best way.  Then you can just assign the image keys and/or indexes when using an image list control.

By Edhy Rijo - 5/12/2008

Thanks Trent, Keith,

I will try adding the additional resource files to use the new icons.