By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,663 Members | 1,370 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,663 IT Pros & Developers. It's quick & easy.

Drag and Drop in TreeView

P: n/a
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.
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
George Shepherd's Windows Forms FAQ contains an entry entitled:

How do I implement Drag and Drop support between two TreeViews?

Check it out at:
http://www.syncfusion.com/faq/winforms/search/617.asp

=============================================
Clay Burch, .NET MVP

Syncfusion, Inc.
visit http://www.syncfusion.com for .NET Essentials
" #Hai" <Re**********@Mail.com> wrote in message
news:u5**************@TK2MSFTNGP12.phx.gbl...
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.

Nov 13 '05 #2

P: n/a
You can find the solution in http://longreat.com, or sutiable item for you.

" #Hai" <Re**********@Mail.com> bl
news:u5**************@TK2MSFTNGP12.phx.gbl g...
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.

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.