private void List_Drop(object sender, DragEventArgs e) { var pt = e.GetPosition(this); if (Math.Abs(pt.Y - _prewPt.Y) < 10) { return; } if (TagGrp == null) { return; } var tagWrap = e.Data.GetData(typeof(TagWrap)) as TagWrap; var mode = DragProcessor.GetDragMode(e); if (tagWrap != null) { if (DragTo == null) // перетащили на пустое место { TagGrp.TagList.Add(new TagWrap() { Tag = tagWrap.Tag }); if (!CopyMode) { tagWrap.Tag = new Tag(); } } else { if (SwapMode) { tagWrap.SwapWith(DragTo, mode); } else { TagWrap newTag = new TagWrap(); int pos = TagGrp.TagList.IndexOf(DragTo); if (pos == -1) { pos = 0; } newTag.SwapWith(tagWrap, mode); TagGrp.TagList.Insert(pos, newTag); } } } else { DragProcessor.DragNodes(DragTo, e); } }
private void NodeList_Drop(object sender, DragEventArgs e) { var pt = e.GetPosition(this); if (Math.Abs(pt.Y - _prewPt.Y) < 10) { return; } var secondTag = e.Data.GetData(typeof(TagWrap)) as TagWrap; var mode = DragProcessor.GetDragMode(e); if (secondTag != null) { CurTag.SwapWith(secondTag, mode); } DragProcessor.DragNodes(CurTag, e, _droppedNode); }