I'm doing project in windows forms using c#. I want to show an image in the listview subitems. For eg:- There is a listview having 3 Columns (Column 1 is Roll number,Column 2 is StudentName,Column 3 is StudentPhoto) .I can use the ListViewItems to add Items in the ListView. Adding First items开发者_开发问答 to the ListView,
ListViewItem item = new ListViewItem("101");
item.SubItem.Add("Robin");
SampleListView.Items.Add(item);
Now i'm having difficult in Showing StudentImage in the 3rd column,Can anyone help!
Note: Also i have ImageList assigned to SampleListView.
ListView does wrap the native list view control from common controls of Windows. This control does not directly support images on subitems. You need to set the listview it to owner draw to let you handle the drawing.
Luckily others have done this already. On CodeProject there is a good one.
精彩评论