protected void DragDropEvent(object sender, DragEventArgs e) { try { IDragDropItem targetNode = null; IDragDropItem node = DragEventCommon(sender, e, ref targetNode); if (node != null) { Cursor save = Cursor.Current; Cursor.Current = Cursors.WaitCursor; node.DoDrop(targetNode); Cursor.Current = save; } else { // If we are not handling this, see of there is an // ancestor control that's interested IDropTarget con = FindAncestorDropControl(e); if (con != null) { con.DragDropEvent(sender, e); } } } catch (Exception ex) { TraceUtil.WriteLineWarning(this, "Exception in event handler: " + ex); } }
// Here the tree is functioning like a tree node // for drag/drop. This is used from a DragDropPanel // where something is dropped on the design surface, // but this tree is delegated to handling it. // We give it to the top-level node. public virtual void DoDrop(IDragDropItem node) { if (_isObjectContainer) { IDragDropItem targetNode = ObjectBrowser.GetTopLevelObjectNode(); targetNode.DoDrop(node); } }