在MouseDown中判断鼠标位置应该可以吧比如: Private Sub Tree_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Dim tree As TreeView = CType(sender, TreeView) Dim n As TreeViewHitTestInfo = tree.HitTest(e.Location) If n.Node IsNot Nothing Then If n.Node.Bounds.Contains(e.Location) Then MsgBox("Node") End If End If End Sub
Dim tree As TreeView = CType(sender, TreeView)
Dim n As TreeViewHitTestInfo = tree.HitTest(e.Location)
If n.Node IsNot Nothing Then
If n.Node.Bounds.Contains(e.Location) Then MsgBox("Node")
End If
End If
End Sub
{
Rectangle _Rect = treeView1.RectangleToScreen(new Rectangle(0,0,0,0)); int _X=Cursor.Position.X - _Rect.X;
int _Y=Cursor.Position.Y - _Rect.Y; TreeNode _Node = treeView1.GetNodeAt(_X, _Y); if (_Node != null && _Node.Bounds.Contains(_X, _Y))
{
MessageBox.Show(_Node.Text);
} }不知道是不是你要的意思 doubleclick 也一样