public static void SetDropHilited(this TreeNode node, bool value)
 {
     if (node == null)
     {
         throw new ArgumentNullException();
     }
     if (!((node.TreeView != null) && node.TreeView.IsHandleCreated))
     {
         throw new InvalidOperationException();
     }
     if (value)
     {
         Windows.SendMessage(node.TreeView.Handle, 0x110b, (IntPtr) 8L, node.Handle);
     }
     else
     {
         TVITEM pitem = new TVITEM {
             hItem = node.Handle,
             mask = TVIF.TVIF_HANDLE | TVIF.TVIF_STATE,
             state = value ? TVIS.TVIS_DROPHILITED : ((TVIS) 0),
             stateMask = TVIS.TVIS_DROPHILITED
         };
         CommCtrl.TreeView_SetItem(node.TreeView.Handle, ref pitem);
     }
 }
 public static bool GetDropHilited(this TreeNode node)
 {
     if (node == null)
     {
         throw new ArgumentNullException();
     }
     if (!((node.TreeView != null) && node.TreeView.IsHandleCreated))
     {
         return false;
     }
     TVITEM pitem = new TVITEM {
         hItem = node.Handle,
         mask = TVIF.TVIF_HANDLE | TVIF.TVIF_STATE,
         stateMask = TVIS.TVIS_DROPHILITED
     };
     CommCtrl.TreeView_GetItem(node.TreeView.Handle, ref pitem);
     return ((pitem.state & TVIS.TVIS_DROPHILITED) > ((TVIS) 0));
 }
示例#3
0
 private void HideCheckBox(TreeNode node)
 {
     TVITEM tvi = new TVITEM();
     tvi.hItem = node.Handle;
     tvi.mask = TVIF_STATE;
     tvi.stateMask = TVIS_STATEIMAGEMASK;
     tvi.state = 0;
     IntPtr lparam = Marshal.AllocHGlobal(Marshal.SizeOf(tvi));
     Marshal.StructureToPtr(tvi, lparam, false);
     SendMessage(this.file_list.Handle, TVM_SETITEM, IntPtr.Zero, lparam);
 }
 public static void TreeView_SetItem(IntPtr hwndTV, ref TVITEM pitem)
 {
     SendMessage(hwndTV, TreeView_GetUnicodeFormat(hwndTV) ? 0x113f : 0x110d, IntPtr.Zero, ref pitem);
 }
 private static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, ref TVITEM lParam);
 public static void SetHasChildren(this TreeNode node, bool value)
 {
     if (node == null)
     {
         throw new ArgumentNullException();
     }
     if (!((node.TreeView != null) && node.TreeView.IsHandleCreated))
     {
         throw new InvalidOperationException();
     }
     TVITEM pitem = new TVITEM {
         hItem = node.Handle,
         mask = TVIF.TVIF_CHILDREN | TVIF.TVIF_HANDLE,
         cChildren = value ? 1 : 0
     };
     CommCtrl.TreeView_SetItem(node.TreeView.Handle, ref pitem);
 }