private void treeView1_DragDrop(object sender, DragEventArgs e)
{
TreeNode sourceNode;
if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
{
Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));
TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt);
sourceNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");
if (DestinationNode.TreeView != sourceNode.TreeView)
{
IMEPackage importpcc = sourceNode.TreeView.Tag as IMEPackage;
if (importpcc == null)
{
return;
}
int n = Convert.ToInt32(sourceNode.Name);
int link;
if (DestinationNode.Name == "")
{
link = 0;
}
else
{
link = Convert.ToInt32(DestinationNode.Name);
link = link >= 0 ? link + 1 : link;
}
int nextIndex;
if (n >= 0)
{
if (!importExport(importpcc, n, link))
{
return;
}
nextIndex = pcc.ExportCount;
}
else
{
importImport(importpcc, -n - 1, link);
nextIndex = -pcc.ImportCount;
}
if (sourceNode.Nodes.Count > 0)
{
importTree(sourceNode, importpcc, nextIndex);
}
RefreshView();
goToNumber(n >= 0 ? pcc.ExportCount - 1 : -pcc.ImportCount);
}
}
}