BExplorer.Shell.ShellTreeViewEx.SetNodeImage C# (CSharp) Method

SetNodeImage() private method

private SetNodeImage ( IntPtr node, IntPtr pidl, IntPtr m_TreeViewHandle, System.Boolean isOverlayed ) : void
node System.IntPtr
pidl System.IntPtr
m_TreeViewHandle System.IntPtr
isOverlayed System.Boolean
return void
		private void SetNodeImage(IntPtr node, IntPtr pidl, IntPtr m_TreeViewHandle, Boolean isOverlayed) {
			try {
				var itemInfo = new TVITEMW();

				// We need to set the images for the item by sending a
				// TVM_SETITEMW message, as we need to set the overlay images,
				// and the .Net TreeView API does not support overlays.
				itemInfo.mask = TVIF.TVIF_IMAGE | TVIF.TVIF_SELECTEDIMAGE | TVIF.TVIF_STATE;
				itemInfo.hItem = node;
				itemInfo.iImage = ShellItem.GetSystemImageListIndex(pidl, ShellIconType.SmallIcon, ShellIconFlags.OverlayIndex);
				if (isOverlayed) {
					itemInfo.state = (TVIS)(itemInfo.iImage >> 16);
					itemInfo.stateMask = TVIS.TVIS_OVERLAYMASK;
				}
				itemInfo.iSelectedImage = ShellItem.GetSystemImageListIndex(pidl, ShellIconType.SmallIcon, ShellIconFlags.OpenIcon);
				this.UpdatedImages.Add(node);
				User32.SendMessage(m_TreeViewHandle, MSG.TVM_SETITEMW, 0, ref itemInfo);
			} catch (Exception) {
			}
		}