public void Cancel_Move_Mode(TreeNode selectNode)
 {
     Cursor           = Cursors.Default;
     AllowDrop        = false;
     dragNode         = null;
     dragBitmapCursor = null;
     SelectedNode     = selectNode;
 }
        protected virtual Cursor CreateDragCursor(TreeNode node)
        {
            int    width  = 100;
            int    height = 20;
            string text   = "Invalid";

            if (node != null)
            {
                width = node.Bounds.Width + 100;
                if (width == 0)
                {
                    width = 100;
                }
                height = node.Bounds.Height;
                text   = node.Text;
            }

            Rectangle r = new Rectangle(0, 0, width, height);

            using (Graphics g0 = CreateGraphics())
                using (Bitmap bmp = new Bitmap(width, height * 4, g0))
                    using (Graphics g = Graphics.FromImage(bmp))
                    {
                        g.Clear(Color.FromArgb(0, 0, 0, 0));

                        Color cb1 = Color.FromArgb(255, 0, 89, 181);
                        Color cb2 = Color.FromArgb(0, 0, 89, 181);
                        using (Brush b = new LinearGradientBrush(r, cb1, cb2, 0, false))
                            g.FillRectangle(b, 0, 0, width, height);

                        Color ct1 = Color.FromArgb(255, 255, 255, 255);
                        Color ct2 = Color.FromArgb(64, 255, 255, 255);
                        using (Brush b = new LinearGradientBrush(r, ct1, ct2, 0, false))
                            g.DrawString(text, Font, b, 0, 0);


                        dragBitmapCursor = new BitmapCursor(bmp, Cursors.Default);
                        return(dragBitmapCursor.Cursor);
                    }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnDragDrop(DragEventArgs e)
        {
            // Custom cursor handling
            Cursor = Cursors.Default;

            // Check it's a treenode being dragged
            if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
            {
                // Get the target node from the mouse coords
                Point    pt         = (this).PointToClient(new Point(e.X, e.Y));
                TreeNode targetNode = GetNodeAt(pt);

                // 1) Check we're not dragging onto ourself
                // 2) Check we're not dragging onto one of our children
                // (this is the lazy way, will break if there are nodes with the same name,
                // but it's quicker than checking all nodes below is)
                // 3) Check we're not dragging onto our parent
                if ((targetNode != dragNode) && (!targetNode.FullPath.StartsWith(dragNode.FullPath)) && (dragNode.Parent != targetNode))
                {
                    // Perform PAGE check
                    bool target_page = false;
                    if ((targetNode.Tag != null) && (((abstract_TreeNode)targetNode.Tag).Page))
                    {
                        target_page = true;
                    }

                    // Page can't be dropped in page, and Division can't be dropped in page
                    if (!target_page)
                    {
                        // Copy the node, add as a child to the destination node
                        dragNode.Remove();
                        targetNode.Nodes.Add(dragNode);
                        targetNode.Expand();

                        if (dragNode.SelectedImageIndex == 7)
                        {
                            dragNode.SelectedImageIndex = 4;
                            dragNode.ImageIndex         = 4;
                        }

                        // Call drag complete event
                        if (DragComplete != null)
                        {
                            DragComplete(this, new DragCompleteEventArgs(dragNode, targetNode));
                        }
                    }

                    // Remove Original Node, set the dragged node as selected
                    SelectedNode = dragNode;

                    // Clear some values
                    dragBitmapCursor = null;
                }
                else
                {
                    SelectedNode = dragNode;
                }
            }

            base.OnDragDrop(e);
        }