.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> Windows Form Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Display multiple thumbnail image in Listview

Posted By:Hiren Soni       Posted Date: August 29, 2010    Points: 10    Category: Windows Form Controls    URL: http://www.dotnetspark.com  

Display multiple thumbnail image in Listview
 


learn how to Display multiple thumbnail image in Listview


ImageList imageList = new ImageList();

OpenFileDialog opend1 = new OpenFileDialog();

opend1.Filter = "Image Files(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*";

opend1.Multiselect = true;



if (opend1.ShowDialog() == DialogResult.OK)

{

listView1.View = View.LargeIcon;

imageList.ImageSize = new Size(100, 100);

for (int c = 0; c < opend1.FileNames.Length; c++)

{

Image i = Image.FromFile(opend1.FileNames[c].ToString());

Image img = i.GetThumbnailImage(100, 100, null, new IntPtr());

imageList.Images.Add(img);

}



listView1.LargeImageList = imageList;



for (int j = 0; j < imageList.Images.Count; j++)

{

ListViewItem lstItem = new ListViewItem();

lstItem.ImageIndex = j;

listView1.Items.Add(lstItem);

}

}

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend