I have the following function (that is incorrect):
private void TreeView_DragDrop(object sender, DragEventArgs e)
{
TreeNode CurrentNode =
TreeView.GetNodeAt(e.X - this.Left - NotesView.Left,
e.Y - this.Top - NotesView.Top);
// [snip]...
}
But this is incorrect because it doesn't take into account the forms decorations... I'm sure there has to be a better way to do this other than hard coding it (which'll be wrong anyway, depending on several things such as Vista vs XP vs Win2k), but I can't find it.
You can use:
Point clientPoint = TreeView.PointToClient( new Point( e.X, e.Y ) );
to get relative coordinates.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With