A
Alan T
I have a dragdrop event to capture the treenode that trigger that event.
However, I always get the returned node is null.
private void trvEmployee_DragDrop(object sender, DragEventArgs e)
{
TreeNode targetNode;
MessageBox.Show(e.X.ToString + " -- " + e.Y.ToString());
targetNode = trvEmployee.GetNodeAt(e.X, e.Y);
if (targetNode == null)
{ MessageBox.Show(" null");
}
else
{ MessageBox.Show(target.Text);
}
}
I don't know why it showed the e.X and e.Y have valid values but the
targetNode is null.
However, if I hardcode the
targetNode = trvEmployee.GetNodeAt(e.X, e.Y);
to e.X and e.Y to some value, it showed the node.
Note, the AllowDrop perperty has been set to true already.
However, I always get the returned node is null.
private void trvEmployee_DragDrop(object sender, DragEventArgs e)
{
TreeNode targetNode;
MessageBox.Show(e.X.ToString + " -- " + e.Y.ToString());
targetNode = trvEmployee.GetNodeAt(e.X, e.Y);
if (targetNode == null)
{ MessageBox.Show(" null");
}
else
{ MessageBox.Show(target.Text);
}
}
I don't know why it showed the e.X and e.Y have valid values but the
targetNode is null.
However, if I hardcode the
targetNode = trvEmployee.GetNodeAt(e.X, e.Y);
to e.X and e.Y to some value, it showed the node.
Note, the AllowDrop perperty has been set to true already.