Exemple #1
0
        protected override void OnDragLeave(EventArgs e)
        {
            CleanupDragVisuals();

            // Call cancel event
            if (DragCancel != null)
            {
                DragSourceEventArgs ea = new DragSourceEventArgs();
                ea.Nodes = SelectedNodes;
                DragCancel(this, ea);
            }
        }
Exemple #2
0
        protected override void OnKeyUp(KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                DrawSelectedNodesAsNormal();

                if (_dragDestinationNode != null)
                {
                    DrawNodeAsNormal(_dragDestinationNode);
                }

                Cursor = Cursors.Default;

                // Call cancel event
                if (DragCancel != null)
                {
                    DragSourceEventArgs ea = new DragSourceEventArgs();
                    ea.Nodes = SelectedNodes;

                    DragCancel(this, ea);
                }
            }
        }
        protected override void OnItemDrag(ItemDragEventArgs e)
        {
            // if the item wasn't even properly clicked on, don't start a drag
            if (!_clickedNodeWasInBounds)
            {
                return;
            }

            base.OnItemDrag(e);

            // Call dragstart event
            if (DragStart != null)
            {
                DragSourceEventArgs ea = new DragSourceEventArgs();
                ea.Nodes = SelectedNodes;
                DragStart(this, ea);
            }

            DrawSelectedNodesAsDragSource();

            // Start drag drop
            DoDragDrop(SelectedNodes, DragDropEffects.All);
        }