473,394 Members | 1,750 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

determining a treeview node droped onto

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
1 1126
>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

HTH

Alan.

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Steve | last post by:
I have created a transparent custom drawn treeview in c#(using lots of native code as well) that has a bitmap for its background. As well as that, I have created a custom highlight that is a...
3
by: vijaynats | last post by:
I have a treeview with a ContextMenu attached. When i click on a node, AfterSelect fires but does not fire when right clicked (the context menu pops up). (Background: I have loaded a list of...
2
by: Juan Romero | last post by:
Hey guys, I am trying to detect a node right click event, but I can't seem to find a way do this. The only way I found to get to a point where I know the user clicked the node is by checking...
5
by: Brian Henry | last post by:
I need a way to give each node an id number onto of what the text is being displayed so i can access data in a database... how would i do this? this is an example RootNode (data: root) + Child1...
6
by: L.M | last post by:
Hello, I knew how to use the treeview under VB6. After migrating to .NET, well, I'm lost. I try to add a new node, either to the same level or as a child to a selected node in the treeview....
2
by: Andrew Ducker | last post by:
I have a treeview linked to a series of panels, making the correct panel visible depending on which node is selected. I now want to check that the user is allowed to leave the current node...
8
by: Matt MacDonald | last post by:
Hi All, I have a form that displays hierarchical categories in a treeview. Ok so far so good. What I was to do is have users be able to select a node in the treeview as part of filling out the...
6
by: serge calderara | last post by:
Dear all, I was wondering is there is a way to customise the treView control in order to get any Control as a Node. What I try to do is having a Progress bar as a treeview node object. Is...
0
by: munishbatra2002 | last post by:
hi all, we are using a gridview and a treeview control ... we want to drag a row from gridview control and drop it onto treeview control on a web page... we are using C# ASP.NET ... can anyone...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.