Beispiel #1
0
 public static extern int SendMessage(IntPtr hWnd, MSG Msg,
                                      int wParam, ref TVITEMW lParam);
Beispiel #2
0
 public static extern int SendMessage(IntPtr hWnd, MSG Msg,
     int wParam, ref TVITEMW lParam);
        void SetNodeImage(TreeNode node)
        {
            TVITEMW itemInfo = new TVITEMW();
            ShellItem folder = (ShellItem)node.Tag;

            // 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.Handle;
            itemInfo.iImage = folder.GetSystemImageListIndex(
                ShellIconType.SmallIcon, ShellIconFlags.OverlayIndex);
            itemInfo.iSelectedImage = folder.GetSystemImageListIndex(
                ShellIconType.SmallIcon, ShellIconFlags.OpenIcon);
            itemInfo.state = (TVIS)(itemInfo.iImage >> 16);
            itemInfo.stateMask = TVIS.TVIS_OVERLAYMASK;
            User32.SendMessage(m_TreeView.Handle, MSG.TVM_SETITEMW,
                0, ref itemInfo);
        }