Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
What is the proper way to set images for items in a listview?
posted

Hi Everyone-

I am working my way through C# and the Infragistics Controls, kind of still a noob at C#. I am wondering the proper way to use images in the application. For instance, I have a bunch of .ICO icon files. Each of those files contains multiple resolutions. 16x16 and 32x32 being the ones I'm really caring about. There are two places in my app where I want to use these icon images. One place is the listview, at 16x16, another place is on the picturebox, 32x32.

I am just looking for the "proper" way of doing this. Playing around all day, I finally ended up creating two imagelists. One imagelist with the size set to 16x16, another with the size set to 32x32. I named one of them ImageList32x32 and another ImageList16x16. For the listview, I do something like listview....Appearence.Image = ImageList16x16.Images[4] ... For the picturebox I do picturebox...Image = ImageList32x32.Images[4]. That seems to work well, but I'm thinking that the application is possibly compiling two of each .ICO file into the app in order to make it work, and I just do not know if it is the right way of doing it.

Is there another way, possibly to use one imageList and somehow set the Size on the fly? (I've tried this, and when I set the size by doing ImageList.Size = new Size(32,32) it erases the entire imagelist so no images are in it anymore.

 

Thanks in advance!

Parents Reply Children
No Data