Im trying to create a listview showing images with text

so how exactly can i do this? (im using visual studio if it helps)

Heres the code that isn't working now

// adding images ...
        imageList1.Images.Add("Unique key", Image.FromFile("..."));
        listView1.Items.Add("text for image", "Unique key");
        /*
         * more
         * images
         * 
         * */
        listView1.LargeImageList = imageList1;

i also tried inserting listView1.LargeImageList = imageList1; before adding the images.

how can make this listview show images with text the way i want?

Im trying to create a listview showing images with text

so how exactly can i do this? (im using visual studio if it helps)

Heres the code that isn't working now

// adding images ...
        imageList1.Images.Add("Unique key", Image.FromFile("..."));
        listView1.Items.Add("text for image", "Unique key");
        /*
         * more
         * images
         * 
         * */
        listView1.LargeImageList = imageList1;

i also tried inserting listView1.LargeImageList = imageList1; before adding the images.

how can make this listview show images with text the way i want?

I ran a test using your code and no image was drawn as you said. Then, I setup the ListView control to contain the imageList I added to the form and it appeared fine. I am guessing that the imagekey attempts to be associated at the time the new item is added listView1.Items.Add("text for image", "Unique key"); . Try associating the imageList first before you add the new item: listView1.LargeImageList = imageList1; , then add item...

thanks worked great. I think it also had something to do with how i was trying to change the image size of each image.

Is there a way to set a different ImageSize for every image?

The image list enforces the image size for the images in the collection with imageList.ImageSize . Is that what you were referring to?

thanks worked great. I think it also had something to do with how i was trying to change the image size of each image.

Is there a way to set a different ImageSize for every image?

The ImageList.ImageSize property pertains to all images in the list and I don't believe you can individually set each image's size.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.