void IDropTarget.Drop(HtmlMouseEvent e, DropEffects dropEffect) { RootNodes rootNodes = (RootNodes)treeView.NodeSource; RootNode rootNode = webNode.RootNode; long index = hit != null ? hit.Index : -1; if (index >= 0 && 2 * (clientY - hit.Rect.Top) >= hit.Rect.Height) { index++; } if (dropEffect == DropEffects.Move) { int pos = 0; while (rootNodes[pos] != rootNode) { pos++; } rootNodes.RemoveRootNode(pos); if (index > pos) { index--; } } else { rootNode = new RootNode() { Url = webNode.Url, Title = webNode.Title, IsSite = rootNode != null && rootNode.IsSite, RootNodes = rootNodes }; } if (index >= 0) { rootNodes.InsertRootNode(index, rootNode); } else { rootNodes.Configuration.Roots.Add(rootNode); } }