private void treeView1_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(typeof(ListViewItem))) { string DropInPath = string.Empty; string SelectedImage = string.Empty; ListViewItem li = (ListViewItem)e.Data.GetData(typeof(ListViewItem)); TreeNode nodeToDropIn = this.treeView1.GetNodeAt(this.treeView1.PointToClient(new Point(e.X, e.Y))); if (nodeToDropIn == null) { return; } if (nodeToDropIn.Level > 0) { try { DropInPath = nodeToDropIn.FullPath; SelectedImage = SelectedFolder + "\\" + li.Text; this.fldImageList.Images[li.Text].Dispose(); this.fldImageList.Images.RemoveAt(li.Index); File.Move(SelectedImage, DropInPath); } catch (Exception ex) { MessageBox.Show(ex.Message); } } if (li == null) { return; } nodeToDropIn.Nodes.Add(li.Text); fldListview.Items.Remove(li); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)