Пример #1
0
        private void treeViewAdv_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
        {
            // Determine drag effects
            bool        droppable       = true;
            TreeNodeAdv destinationNode = null;
            TreeViewAdv treeView        = sender as TreeViewAdv;
            Point       ptInTree        = treeView.PointToClient(new Point(e.X, e.Y));

            this.currentSourceNode = null;

            // Looking for a single tree node.
            if (e.Data.GetDataPresent(typeof(TreeNodeAdv[])))
            {
                // Get the destination and source node.
                destinationNode = treeView.GetNodeAtPoint(ptInTree);
                TreeNodeAdv[] sourceNode = (TreeNodeAdv[])e.Data.GetData(typeof(TreeNodeAdv[]));
                // Cache this for use later in the TreeDragDrop_QueryAllowedPositionsForNode event handler.
                this.currentSourceNode = sourceNode;
                //droppable = this.CanDrop(sourceNode, destinationNode);
            }
            else
            {
                droppable = false;
            }

            if (droppable)
            {
                // If Moving is allowed:
                e.Effect = DragDropEffects.Move;
            }
            else
            {
                e.Effect = DragDropEffects.None;
            }

            // Let the highlight tracker keep track of the current highlight node.
            this.treeViewDragHighlightTracker.SetHighlightNode(destinationNode, ptInTree);
        }