/// <summary> /// Extract the icon for the file type (Extension) /// </summary> protected virtual void SetIcon(TreeViewFolderBrowser treeView, TreeNodePath node) { // create on demand if (_systemImageList == null) { // Shell32 ImageList _systemImageList = new SystemImageList(SystemImageListSize.SmallIcons); SystemImageListHelper.SetTreeViewImageList(treeView, _systemImageList, false); } node.ImageIndex = _systemImageList.IconIndex(node.Path, true); node.SelectedImageIndex = node.ImageIndex; }
protected virtual void AttachSystemImageList(TreeViewFolderBrowserHelper helper) { if (_checkboxMode != helper.TreeView.CheckboxBehaviorMode) { // checkboxes recreate the control internal if (_systemImageList != null) { SystemImageListHelper.SetTreeViewImageList(helper.TreeView, _systemImageList, false); } } _checkboxMode = helper.TreeView.CheckboxBehaviorMode; }
protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); SystemImageListHelper.SetTreeViewImageList(this, CommVar.sil_s, false); Nodes.Clear(); foreach (DriveInfo di in DriveInfo.GetDrives()) { if (di.DriveType == DriveType.Fixed && di.IsReady) { Nodes.Add(di.Name, di.VolumeLabel + " (" + di.Name.Substring(0, 2) + ")", CommVar.sil_s.IconIndex(di.Name), CommVar.sil_s.IconIndex(di.Name)); } } }
//public static void FillTreeView(CFolderCollection folders, TreeNodeCollection tnc) //{ // for (int i = 0; i<folders.Count;i++) // { // int selectfoldericonindex = folders[i].IconIndex == CommVar.CloseFolderIconIndex ? CommVar.OpenFolderIconIndex : folders[i].IconIndex; // FillTreeView(folders[i].Folders, tnc.Add(folders[i].Name, folders[i].Name, folders[i].IconIndex, selectfoldericonindex).Nodes); // } //} protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); SystemImageListHelper.SetTreeViewImageList(this, CommVar.sil_s, false); }