private void advTree1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)//判断你点的是不是右键
{
Point ClickPoint = new Point(e.X, e.Y);
Node CurrentNode =advTree1.GetNodeAt(ClickPoint);
if (CurrentNode != null)//判断你点的是不是一个节点
{
ContextMenu menu = new System.Windows.Forms.ContextMenu(); MenuItem i = new MenuItem();
i.Text = "llllll";
menu.MenuItems.Add(i);
CurrentNode.ContextMenu = menu; advTree1.SelectedNode = CurrentNode;//选中这个节点
}
}
}