
 Rank: Guest Groups: Guest
Joined: 9/17/2007 Posts: 11,670 Points: -1,200
|
Date parsed: 06/10/2007 02:49:18 Date: Fri, 05 Oct 2007 14:49:18 +1200
tvNodes is a treeview. In one program using exactly the same code, it provides a selectednode object correctly, however in another using same code it cannot detect which item is under the cursor. Any idea why this should not work - I have checked out properties/events side-by side between both treeview components and they are replicated:
private void tvNodes_DragOver(object sender, System.Windows.Forms.DragEventArgs e) { e.Effect = DragDropEffects.Move; Point pt = PointToClient(new Point(e.X, e.Y)); TreeNode targetNode = this.tvNodes.GetNodeAt(pt); //targetNode always returns null even though its over another node.
|

 Rank: Guest Groups: Guest
Joined: 9/17/2007 Posts: 11,670 Points: -1,200
|
Date parsed: 06/10/2007 04:08:24 Date: Fri, 05 Oct 2007 16:08:24 +1200
Alistair George wrote: > tvNodes is a treeview. In one program using exactly the same code, it > provides a selectednode object correctly, however in another using same > code it cannot detect which item is under the cursor. > Any idea why this should not work - I have checked out properties/events > side-by side between both treeview components and they are replicated: > > private void tvNodes_DragOver(object sender, > System.Windows.Forms.DragEventArgs e) > { > e.Effect = DragDropEffects.Move; > Point pt = PointToClient(new Point(e.X, e.Y)); > TreeNode targetNode = this.tvNodes.GetNodeAt(pt); > //targetNode always returns null even though its over another node. Answer was: Point pt = tvNodes.PointToClient(new Point(e.X, e.Y)); TreeNode targetNode = tvNodes.GetNodeAt(pt); tvNodes.SelectedNode = targetNode;
|