Changing the value of a tree node

Hi everyone, I wrote code to move the file from the source path to a new path that worked fine.

First, my tree will have the root root, and I add child nodes at runtime. My tree is as follows

        Root
          |->C:\some.txt(Assume that it is in c drive)

Now, if I right-click on that, I will have a context menu with the Move options and some others. If I select a transition, I will ask the user to change the path. If the user selects a path, I move the file to the selected destination. Now I need me to want to replace the current child treeview with a new path.

As the original mt file was in c: if I moved it to D:

I need my tree to be

          Root
            |->D:\some.txt
+1
1

- :

private Point location; 

MouseDown TreeView :

private void treeView1_MouseDown(object sender, MouseEventArgs e)
{
    location = e.Location;
}

- :

TreeViewHitTestInfo info =  treeView1.HitTest(location);
info.Node.Text = "new path";
+2

Source: https://habr.com/ru/post/1766202/


All Articles