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

determining a treeview node droped onto

P: n/a
how do you determin what tree node something was drug onto? When I use the
e.x and e.y to get the current node at that point useing GetNodeAt, the e.X
and e.Y are not coordinates on the treeview, but what looks to be a screen
coordinate. But when I do the same thing with a right click to determin what
node was right clicked on the e.X and e.Y are the right coordinates... so
what would drag drop give me different ones? and how should I figure out
what node it was dropped onto? because selectednode also doesnt tell me, but
the last node i selected.
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
>how do you determin what tree node something was drug onto?
I needed to convert to client co-ords and offset into the control

Private Sub TreeViewDragDropHandler( _
ByVal src As Object, _
ByVal e As DragEventArgs _
Dim tgtNode As TreeNode = GetTreeNodeAt(CType(src, TreeView), New
Point(e.X, e.Y))

' do whatever with the treeNode

End Sub
Private Function GetTreeNodeAt( _
ByVal sender As TreeView, _
ByVal pt As Point _
) As TreeNode

Dim clientPos As Point = PointToClient(pt)
clientPos.Offset(-sender.Location.X, -sender.Location.Y)

Return sender.GetNodeAt(clientPos)

End Function



Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.