0

Heres my code :

this.imageList1.Images.Add("Original",image);
this.imageList1.Images.Add("Greyscale",greyscale.ToBitmap());
for (int j = 0; j < this.imageList1.Images.Count; j++)
        {
            ListViewItem item = new ListViewItem();
            item.ImageIndex = j;

            this.listView1.Items.Add(item);
        }

I want to give each image a name/tag so it will show something like this in list view :

enter image description here

but the above code seems not working

nff21
  • 45
  • 7
  • What is type of Image? If you already set the name, you need to bind the field in your ListView DataItemTemplate. – wannadream May 05 '17 at 20:19
  • That's not what that parameter is for. It's a key you can use later to look up the image in the ImageList. If you want to add text to the image itself, [this answer should help you get started with that](http://stackoverflow.com/a/6311628/424129). If what you want to do is something other than that, please explain in more detail. – 15ee8f99-57ff-4f92-890c-b56153 May 05 '17 at 20:20
  • i mean i want to insert image from imagelist to listview and give each image a little name so it will be like the picture above – nff21 May 05 '17 at 20:24
  • why are you assigning item.ImageIndex = j;? – Harry May 05 '17 at 20:26
  • 1
    Set the `item.Text` property. – Hans Passant May 06 '17 at 02:16
  • @HansPassant thanks thats solve my problem – nff21 May 06 '17 at 04:46

0 Answers0