문제

i got on really well since my last visit project done and working really well thanks again.

i'm still having trouble with these pesky list views again this time no text is showing up when i populate my list view.

i'm searching an xml file to see if an option is activated or not and if so i fill a list view with images.

so if the option is active i use this code to store the image in an image list.

imageList1.Images.Add("sms", Image.FromFile(appPath + @"\Icons\sms.jpg")); 

after searching my setup xml and adding said images to my list i populate the list view like this.

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

Now the images show just fine but no text for the image name is displayed.

i thought that was set when i added the image with the "sms" bit if so what am i missing why is nothing showing just images ?

probably me being really dumb and not adding it but how ?

Regards

Del

도움이 되었습니까?

해결책

   ListViewItem item = new ListViewItem();                    
   item.ImageIndex = i;
   item.Text= imageList1.Images.Keys[i].ToString();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top