/// <summary> /// 获取ICO图标 /// </summary> /// <returns></returns> public bool GetIcon(params object[] par) { listIcon.Clear(); if (par.Length > 0) { Icon icon = GetOtherIcon.GetFileIcon(par[0] as string, GetOtherIcon.IconSize.Large, false); if (icon != null) { listIcon.Add(icon); } } else { XmlNodeList personNodes = mXMLHelper.GetXmlNodeListByXpath(Global.mXMLFilePath, "//app/apps"); foreach (var node in personNodes) { Icon icon = GetOtherIcon.GetFileIcon(((XmlElement)node).GetAttribute("fullpath"), GetOtherIcon.IconSize.Large, false); if (icon != null) { listIcon.Add(icon); } } } return((listIcon.Count > 0 && listIcon != null) ? true : false); }
private void app_Load(object sender, EventArgs e) { FileIsOpen.SetWindowPos(this.Handle, -1, 0, 0, 0, 0, 1 | 2); //_app_ListView.LargeImageList.Images.Clear();/* mImgListOneSelf.Images.Clear();*/ mImgListOneSelf.ImageSize = size; foreach (OpenFileInfo item in _fileInfo) { Icon icon = GetOtherIcon.GetFileIcon(item.Name, GetOtherIcon.IconSize.Large, false); mImgListOneSelf.Images.Add(item.HWND.ToString(), icon); } _app_ListView.LargeImageList = mImgListOneSelf; List <IntPtr> ptrList = new List <IntPtr>(); foreach (OpenFileInfo item in _fileInfo) { _app_ListView.Items.Add(Path.GetFileNameWithoutExtension(item.Name), item.HWND.ToString()); ptrList.Add(item.HWND); } _app_ListView.Tag = ptrList; _app_ListView.View = View.LargeIcon; }