private void button6_Click(object sender, EventArgs e)
{
listView1.Items.Clear();
FolderBrowserDialog dlg = new FolderBrowserDialog();
dlg.ShowDialog();
if (dlg.SelectedPath == "") return;
foreach (string files in Directory.GetFiles(dlg.SelectedPath))
{
if ((files.EndsWith(".avi")) || files.EndsWith(".mpeg"))
{
ImageList Imagelist1 = new ImageList();
Imagelist1.ColorDepth = ColorDepth.Depth32Bit;
Imagelist1.ImageSize = new Size (100, 80);
listView1.View = View.LargeIcon;
listView1.LargeImageList = Imagelist1;
ListViewItem ThumbEntry = new ListViewItem();
ThumbEntry.Text = files;
Icon eIcon = System.Drawing.Icon.ExtractAssociatedIcon(files);
Imagelist1.Images.Add(eIcon);
ThumbEntry.ImageIndex = Imagelist1.Images.Count - 1;
listView1.Items.Add(ThumbEntry);
}
}
}
|