示例#1
0
 /// <summary>
 ///     Called when the drop operation is performed on a node
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DragDropHandler(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent("WindowsForms10PersistentObject", false))
     {
         object       data       = e.Data.GetData("WindowsForms10PersistentObject");
         BaseTreeNode sourceNode = data as BaseTreeNode;
         if (sourceNode != null)
         {
             // The location where the element has been dropped
             Point location = PointToClient(new Point(e.X, e.Y));
             BoxControl <TEnclosing, TBoxModel, TArrowModel> target = BoxForLocation(location, null);
             if (target != null)
             {
                 target.AcceptDrop(sourceNode.Model as ModelElement);
             }
         }
     }
 }