C# 树的不同节点显示不同的右键菜单

        private void trvMoldManage_MouseClick(object sender, MouseEventArgs e)
        {
            trvMoldManage.ContextMenuStrip = null;
            TreeNode selectNode = trvMoldManage.GetNodeAt(e.X, e.Y);
            if (selectNode.Level == 2)
            {
                trvMoldManage.ContextMenuStrip = ctmsMold;
            }
            else if (selectNode.Level == 3)
            {
                trvMoldManage.ContextMenuStrip = ctmsMold;
            }
            else if (selectNode.Level == 4)
            {
                trvMoldManage.ContextMenuStrip = cmueDP;
            }

        }

posted @ 2012-05-27 15:29  dekevin  阅读(545)  评论(0编辑  收藏  举报