/// <summary> /// 加载项目 /// </summary> /// <param name="initPath"></param> private void InitListView(MyListItem folderEle, ListViewEx listView, string FilterType) { listView.Items.Clear(); // listView.FolderName = folderEle.Element.AbsoluteFilePath; CreateHeader(listView); //列表头 //加载子文件夹 foreach (XmlNode node in folderEle._element.ChildNodes) { if (node is FolderXmlElement && !(node is TmpltFolderXmlElement) && !(node is ResourcesXmlElement)) { FolderXmlElement folder = (FolderXmlElement)node; if (folder.IsDeleted) { continue; } MyListFolderItem mylvi = new MyListFolderItem(folder, folderEle); if (mainTabControl.SelectedIndex != 0) { mylvi.BreviaryMap = false; } string folderPath = folder.AbsoluteFilePath.Substring(0, folder.AbsoluteFilePath.Length - 1); mylvi.Text = Path.GetFileName(folderPath); mylvi.Text = folder.Title; listView.Items.Add(mylvi); } } //加载子文件 InitListViewSubFile(folderEle._element.ChildNodes, listView, FilterType); if (folderEle.BreviaryMap && folderEle.ListShowView == View.LargeIcon) {//缩略图 listView.LargeImageList.Images.Clear(); listView.LargeImageList.ImageSize = new Size(96, 96); foreach (MyListItem lvitem in listView.Items) { // if (lvitem is MyFileItem1) { string fullPath = lvitem.Element.AbsoluteFilePath; lvitem.ImageIndex = listView.LargeImageList.Images.Add(listView.GetThumbNail(fullPath), Color.Transparent); } } } else { listView.LargeImageList.ImageSize = new Size(32, 32); //加载图标 foreach (MyListItem lvitem in listView.Items) { string fullPath = lvitem.Element.AbsoluteFilePath; KeyValuePair <string, Image> keyImg = GetImageAndKey(fullPath, GetSystemIconType.ExtensionSmall); if (!listView.SmallImageList.Images.ContainsKey(keyImg.Key)) { listView.SmallImageList.Images.Add(keyImg.Key, keyImg.Value); } KeyValuePair <string, Image> keyLargeImg = GetImageAndKey(fullPath, GetSystemIconType.ExtensionLarge); if (!listView.LargeImageList.Images.ContainsKey(keyLargeImg.Key)) { listView.LargeImageList.Images.Add(keyLargeImg.Key, keyLargeImg.Value); } lvitem.ImageKey = keyImg.Key; } } if (folderEle is MyListFolderItem) { listView.View = folderEle.ListShowView; } }