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

Track tree node during drag operation? MouseMove doesn't fire during drag??

P: n/a

I have a typical TreeView/ListView combo and can drag from the
ListView to the TreeView.

I'd like to select the TreeView node that is the target of the drag
operation as the ListView items are dragged around the tree. I
haven't found a way to do this. Apparently TreeView.MouseMove isn't
fired during the drag operation.

Any suggestions or examples?

Thanks,

Sam

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi

You may take a look at the link below.
307968 How To Add TreeView Drag-and-Drop Functionality in a Visual C# .NET
http://support.microsoft.com/?id=307968

private void treeView_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)

In the DragDrop's eventargs, the e.x and e.y will tell us the drop point.

Best regards,

Perter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #2

P: n/a
Hi

I think you may try to handle the DragOver event.
e.g.
TreeNode lastNode = null;
private void treeView1_DragOver(object sender,
System.Windows.Forms.DragEventArgs e)
{
if(lastNode!=null)
lastNode.BackColor=Color.White;
Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));
TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt);
if (DestinationNode!=null)
{
DestinationNode.BackColor = Color.Red;
lastNode = DestinationNode;
}
}

Best regards,

Perter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.