C # Get Project Resources Reference (VS2008)

I currently have a list and I want to add an appropriate icon to each entry.

I created an icon in the project resources and named it "errorIcon.ico". How can I reference this icon / resource and use it in the list?

+1


source to share


1 answer


You need to create an instance first ImageList

, see http://msdn.microsoft.com/en-us/library/system.windows.forms.imagelist.aspx (just add it to your control / custom control). Use the property view to load icons into a list of images.

Then assign a list of images to each ListViewItem ( listViewItem.ImageList = imageList

) and set the index of the icon ( listViewItem.ImageIndex = 0

)



Take a look at the notes here for more information: http://msdn.microsoft.com/en-us/library/system.windows.forms.listviewitem.imageindex.aspx

+1


source







All Articles