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.

Re: Drag and Drop in TreeView by ClayB

ClayB
Sun Jul 06 06:37:06 CDT 2003

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" <ReplyToGroup@Mail.com> wrote in message
news:u5qG0Q6QDHA.1712@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.
>
>



Re: Drag and Drop in TreeView by LonGreat

LonGreat
Sun Jul 06 08:59:55 CDT 2003

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

" #Hai" <ReplyToGroup@Mail.com> ¦b¶l¥ó
news:u5qG0Q6QDHA.1712@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.
>
>