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

后端 未结 2 1205
轮回少年
轮回少年 2020-12-04 01:16

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

相关标签:
2条回答
  • 2020-12-04 02:05

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

    Extended ListView

    0 讨论(0)
  • 2020-12-04 02:10

    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

    0 讨论(0)
提交回复
热议问题