Click here to Skip to main content
16,021,125 members
Please Sign up or sign in to vote.
2.67/5 (3 votes)
See more:
is there any way to view images in listview or imagelist? i'm using c# winapp. the system goes when the user inputs a query in the textbox, then the text in the textbox will search the xml file. when the text match, the image or images will appear in imagelist or picturebox (if the text has many images or just one), whatever will fits most.

please help me with this project.. thanks :)
Posted

1 solution

Try this, hope it will help you:
C#
private void Form1_Load(object sender, EventArgs e)
       {
           this.listView1.LargeImageList = this.imageList1;
           DirectoryInfo di = new DirectoryInfo(@"F:\TEMP\");
           this.listView1.View = View.LargeIcon;
           foreach (FileInfo fi in di.GetFiles("*.jpg"))
           {
               this.listView1.Items.Add(new ListViewItem(fi.Name, fi.FullName));
               this.imageList1.Images.Add(fi.FullName, Image.FromFile(fi.FullName));
           }
       }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900