예제 #1
0
파일: FSExplorer.cs 프로젝트: lujinlong/Apq
		public void AddFile(TreeListViewItem node, string fsFullPath)
		{
			try
			{
				FileInfo diChild = new FileInfo(fsFullPath);
				string strExt = diChild.Extension.ToLower();
				if (strExt == ".exe")
				{
					strExt = diChild.FullName.ToLower();
				}

				Shell32.SHFILEINFO shFileInfo = new Shell32.SHFILEINFO();
				Icon SmallIcon = Apq.Windows.Forms.IconChache.GetFileSystemIcon(diChild.FullName, ref shFileInfo);

				TreeListViewItem ndChild = new TreeListViewItem(diChild.Name);
				node.Items.Add(ndChild);
				if (node.CheckStatus != CheckState.Indeterminate)
				{
					ndChild.Checked = node.Checked;
				}
				ndChild.ImageIndex = _imgList.Images.IndexOfKey(strExt);
				ndChild.SubItems.Add(diChild.Length.ToString("n0"));
				if (strExt.Contains("\\"))
				{
					strExt = "应用程序";
				}
				ndChild.SubItems.Add(shFileInfo.szTypeName);
				ndChild.SubItems.Add(diChild.CreationTime.ToString("yyyy-MM-dd HH:mm:ss"));
				ndChild.SubItems.Add(diChild.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"));

				ndChild.SubItems.Add(diChild.Name);
				ndChild.SubItems.Add("-1");
				ndChild.SubItems.Add("3");//类型{1:Drive,2:Folder,3:File}
			}
			catch { }
		}
예제 #2
0
파일: FSExplorer.cs 프로젝트: lujinlong/Apq
		void FSExplorer_BeforeExpand(object sender, TreeListViewCancelEventArgs e)
		{
			if (e.Item.Level > 0)
			{
				if (e.Item.ImageKey == "文件夹收起")
				{
					Shell32.SHFILEINFO shFolderInfo = new Shell32.SHFILEINFO();
					Apq.Windows.Forms.IconChache.GetFileSystemIcon(e.Item.FullPath, ref shFolderInfo, true);
					e.Item.ImageKey = "文件夹展开";
				}
			}
		}