Exemple #1
0
 protected virtual Shapes.IDiagramShapeCollection DoExternalDrop(DragEventArgs evt)
 {
     DiagramSelection selection1 = evt.Data.GetData(typeof(DiagramSelection)) as DiagramSelection;
     if (selection1 != null)
     {
         DiagramDocument document1 = this.Document;
         if (document1 != null)
         {
             PointF tf1 = this.LastInput.DocPoint;
             Shapes.DiagramShape obj2 = selection1.Primary;
             if (obj2 != null)
             {
                 string text1 = null;
                 Shapes.DiagramShapeCollection collection1 = new Shapes.DiagramShapeCollection();
                 try
                 {
                     this.StartTransaction();
                     SizeF ef1 = DiagramTool.SubtractPoints(tf1, new PointF(obj2.Left + selection1.HotSpot.Width, obj2.Top + selection1.HotSpot.Height));
                     CopyDictionary dictionary1 = document1.CopyFromCollection(selection1, false, true, ef1, null);
                     foreach (Shapes.DiagramShape obj4 in dictionary1.Values)
                     {
                         if (((obj4 == null) || !obj4.IsTopLevel) || (obj4.Document != document1))
                         {
                             continue;
                         }
                         collection1.Add(obj4);
                         if (this.GridSnapDrag != DiagramViewSnapStyle.None)
                         {
                             PointF tf2 = obj4.Location;
                             PointF tf3 = this.FindNearestGridPoint(tf2);
                             obj4.DoMove(this, tf2, tf3);
                         }
                     }
                     DiagramSelection selection2 = this.Selection;
                     selection2.Clear();
                     Shapes.DiagramShape obj5 = (Shapes.DiagramShape)dictionary1[obj2];
                     if ((obj5 != null) && collection1.Contains(obj5))
                     {
                         selection2.Add(obj5);
                     }
                     CollectionEnumerator enumerator2 = collection1.GetEnumerator();
                     while (enumerator2.MoveNext())
                     {
                         Shapes.DiagramShape obj6 = enumerator2.Current;
                         selection2.Add(obj6);
                     }
                     selection2.HotSpot = selection1.HotSpot;
                     text1 = "Drop";
                     this.RaiseExternalObjectsDropped(this.LastInput);
                 }
                 finally
                 {
                     this.FinishTransaction(text1);
                 }
                 return collection1;
             }
         }
     }
     return null;
 }