开发者

C# .net Windows Forms Listview with image in Detail View

I want something like this develop using C# .net for Windows Forms. (ListView Details View). Putting a Image is the problem.

C# .net Windows Forms Listview with image in Detail View

Help me .开发者_运维技巧.!!

Thank You

Yohan


Hope that the following code can help you out. using C#

ImageList il = new ImageList();
il.Images.Add("test1", Image.FromFile(@"c:\Documents\SharpDevelop Projects\learning2\learning2\Koala.jpg"));

listView1.View = View.LargeIcon;
listView1.LargeImageList = il;
listView1.Items.Add("test");

for(int i = 0; i < il.Images.Count; i++)
{
    ListViewItem lvi = new ListViewItem();
    lvi.ImageIndex = i;
    lvi.Text="koala 1";
    listView1.Items.Add(lvi);
}

Running this kind of code can get you the image and the text in a listview. For further more details, refer to this post


You may want to take a look at this Code Project entry.

Extended ListView

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜