贤人必须成人,成人才能达己.

共同进步

  :: :: 博问 :: 闪存 :: 新随笔 :: :: :: 管理 ::

private void addChildren(string GroupName)
        {
            //首先判断是否选定组件中节点的位置
            if (this.groupTreeView.SelectedNode == null)
            {
                MessageBox.Show("请选择一个节点", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                if (GroupName != "")
                {
                    //创建一个节点对象,并初始化
                    TreeNode tmp;

                    tmp = new TreeNode(GroupName);
                    tmp.Name = "02";
                    tmp.Tag = "02";
                    //在treeview组件中加入兄弟节点
                    this.groupTreeView.SelectedNode.Nodes.Add(tmp);
                    this.groupTreeView.SelectedNode  = tmp;
                    this.groupTreeView.ExpandAll();
                }
                else
                {
                    MessageBox.Show("textbox组件必须填入节点名称!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            //treenode tnode = new treenode ( textbox1.text ) ;
        }

 //删除节点
        private void delNode()
        {
        
            //删除节点
            try
            {
                if (MessageBox.Show("确认删除该节点吗?", "信息提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                {
                    this.groupTreeView.SelectedNode.Remove();

                }
                TreeView2Xml.Save(this.groupTreeView);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }

 private void addparent (string GroupName)
       {
        //首先判断是否选定组件中节点的位置
            if ( this.groupTreeView .SelectedNode  == null )
            {
                MessageBox.Show  ( "请选择一个节点" , "提示信息" , MessageBoxButtons.OK , MessageBoxIcon.Information  ) ;
            }
            else
            {
                if (GroupName != "")
                {
                    //创建一个节点对象,并初始化
                    TreeNode tmp;

                    tmp = new TreeNode(GroupName);
                    tmp.Name = "01";
                    tmp.Tag = "01";
                    //在treeview组件中加入兄弟节点
                    this.groupTreeView.Nodes.Add (tmp);
                    this.groupTreeView .ExpandAll ();
                }
                else
                {
                    MessageBox.Show ("textbox组件必须填入节点名称!", "提示信息", MessageBoxButtons.OK , MessageBoxIcon.Information );
                    return ;
                }
            }
            //treenode tnode = new treenode ( textbox1.text ) ;
        }

posted on 2008-09-10 10:07  adi  阅读(160)  评论(0编辑  收藏  举报