Drag and Drop in TreeView

H

#Hai

Hi,
I have a TreeView control with hierarchy:
A
| - B // source
| - C
D // dest
| - E

Whenever draging B in to D, Item B is removed and B is added into D node.
To implement this task, I ,firstly, write a simple MouseDown event to start
a drag-drop action:
private void tree_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
{
DragDropEffects dde1=DoDragDrop(s, DragDropEffects.All);
}
Which such simple methods, I do not expect my task is achieved. I just
expected that my tree-view acted normally. But what happend ?
When I click (not drag) the item B (or C or D), item B is chosen. But, when
I move the mouse (after I click the item) out of the treeview, the selected
node in the tree turns back to item A.

Is there any mistakes ? Can any one help me to make the tree view acting
normally ?

Thank in advanced.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top