Add more than 2 images in a ListViewItem C#

Viewed 372

I need to add more than two images for a list view item and I know that I can use two lists only: StateImageList and either Large or SmallImageLists by setting both ImageIndex and StateImageIndex. Is there a possibility to add more than two images on the same list view tem (same column).

Thank you!

1 Answers

If you want to add the images to the ListView by code.Two images for a list view item ,you can refer the code.

  public void Form_Load(object sender, EventArgs e)
            {
                DirectoryInfo dir = new DirectoryInfo(@"Path OF Image");
                foreach (FileInfo file in dir.GetFiles())
                {
                    try
                    {
                        this.imageLists.Images.Add(Image.FromFile(file.FullName));
                    }
                    catch{
                        Console.WriteLine("This is not an image file");
                    }
                }
                this.listViewImage.View = View.LargeIcon;
                this.imageLists.ImageSize = new Size(50, 50);
                this.listViewImage.LargeImageList = this.imageLists;

                for (int j = 0; j < this.imageLists.Images.Count; j++)
                {
                    ListViewItem item = new ListViewItem();
                    item.ImageIndex = j;
                    this.listView1.Items.Add(item);
                }
            }
Related