private void treeView1_DragDrop(object sender, DragEventArgs e)
        {
            Array a = (Array)e.Data.GetData(DataFormats.FileDrop);

            DragHelper.ImageList_DragLeave(Handle);
            TreeNode dropNode = GetNodeAt(PointToClient(new Point(e.X, e.Y)));

            if (a != null)
            {
                string s = null;
                for (int i = 0; i < a.Length; i++)
                {
                    s = a.GetValue(i).ToString();
                    this.BeginInvoke(m_DelegateOpenFile, s, dropNode);
                }
            }
            else
            {
                if (_dragNode != dropNode)
                {
                    BaseWrapper  drag     = ((BaseWrapper)_dragNode);
                    BaseWrapper  drop     = ((BaseWrapper)dropNode);
                    ResourceNode dragging = drag.Resource;
                    ResourceNode dropping = drop.Resource;

                    if (dropping.Parent == null)
                    {
                        goto End;
                    }

                    bool ok = false;
                    if (ModifierKeys == Keys.Shift)
                    {
                        ok = TryAddChild(dragging, dropping);
                    }
                    else
                    {
                        ok = TryDrop(dragging, dropping);
                    }

                    if (ok)
                    {
                        BaseWrapper b = FindResource(dragging);
                        if (b != null)
                        {
                            b.EnsureVisible();
                            SelectedNode = b;
                        }
                    }

End:
                    _dragNode      = null;
                    _timer.Enabled = false;
                }
            }
        }
        private void treeView1_DragOver(object sender, DragEventArgs e)
        {
            Array a = (Array)e.Data.GetData(DataFormats.FileDrop);

            Point formP = PointToClient(new Point(e.X, e.Y));

            DragHelper.ImageList_DragMove(formP.X - Left, formP.Y - Top);

            TreeNode dropNode = GetNodeAt(PointToClient(new Point(e.X, e.Y)));

            if (dropNode == null && a == null)
            {
                e.Effect = DragDropEffects.None;
                return;
            }

            e.Effect = DragDropEffects.Move;

            if (_tempDropNode != dropNode)
            {
                DragHelper.ImageList_DragShowNolock(false);
                SelectedNode = dropNode;
                DragHelper.ImageList_DragShowNolock(true);
                _tempDropNode = dropNode;
            }

            TreeNode tmpNode = dropNode;

            if (tmpNode != null)
            {
                while (tmpNode.Parent != null)
                {
                    if (tmpNode.Parent == _dragNode)
                    {
                        e.Effect = DragDropEffects.None;
                    }

                    tmpNode = tmpNode.Parent;
                }
            }
        }
 private void treeView1_DragLeave(object sender, EventArgs e)
 {
     DragHelper.ImageList_DragLeave(Handle);
     _timer.Enabled = false;
 }
 private void treeView1_DragEnter(object sender, DragEventArgs e)
 {
     DragHelper.ImageList_DragEnter(Handle, e.X - Left, e.Y - Top);
     _timer.Enabled = true;
 }