View difference between Paste ID: TXwEMiE4 and t6Cmxxuq
SHOW: | | - or go back to the newest paste.
1-
private void treeView1_ItemDrag(object sender, ItemDragEventArgs e)
1+
private void treeView1_DragEnter(object sender, DragEventArgs e)
2
        {
3-
            if (e.Button != MouseButtons.Left || (e.Item as TreeNode) == null)
3+
            e.Effect = DragDropEffects.Copy;
4
        }
5
6-
            try
6+
        private void treeView1_DragDrop(object sender, DragEventArgs e)
7-
            {
7+
8-
                string[] fileList = new string[] { (e.Item as TreeNode).Text.ToString() };
8+
            TreeNode t = treeView1.GetNodeAt(treeView1.PointToClient(new Point(e.X, e.Y)));
9-
                DataObject fileDragData = new DataObject(DataFormats.FileDrop, fileList);
9+
            if (t == null)
10-
                DoDragDrop(fileDragData, DragDropEffects.Copy);
10+
11-
            }
11+
            string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false);
12-
            catch (Exception ex)
12+
            foreach (string File in FileList)
13-
            {
13+
                t.Nodes.Add(File);
14-
                MessageBox.Show(ex.Message, "DragNDrop Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
14+