|
file:///C:/Users/Administrator/AppData/Roaming/Tencent/Users/1092076002/QQ/WinTemp/RichOle/))VMDBBNHIZ(R2N0_00QXFW.jpg
代码:
DirectoryInfo dicInfo = new DirectoryInfo(@"D:\桌面管理文件夹\系统工具\");
FileInfo[] textFiles = dicInfo.GetFiles("*" + listBox1.Text + "*.*", SearchOption.TopDirectoryOnly);
foreach (FileInfo fileInfo in textFiles)
{
listBox1.Items.Add(fileInfo.FullName); //获取遍历路径
Icon ico = Icon.ExtractAssociatedIcon(fileInfo.FullName);//ExtractAssociatedIcon获取图标
img.Add(ico.ToBitmap()); //把图标集放入数组
ljn.Add(fileInfo.FullName); //路径集合
imageList1.Images.Add(ico); //图片集合
ljname.Add(Path.GetFileNameWithoutExtension(fileInfo.FullName));
for (int j = 0; j < ljname.Count; j++) //遍历程序名称
{
listView1.Items.Add(ljname[j]);
for (int i = 0; i < imageList1.Images.Count; i++) //遍历程序图标
{
this.listView1.Items.ImageIndex = i;
}
}
}
|
|