private void 添加同级分组ToolStripMenuItem_Click(object sender, EventArgs e)//添加同级分组 { Form2 form2 = new Form2(); if (form2.ShowDialog() == DialogResult.OK) { XmlPath = @"..\..\List.xml"; string NodeName = form2.textBox1.Text.Trim(); tx.AddXmlNode(XmlPath, NodeName); tx.XMLtoTree(XmlPath, treeView2); MessageBox.Show("添加成功!"); } form2.Dispose(); }
private void toolStripButton1_Click(object sender, EventArgs e) { Form2 form2 = new Form2(); form2.ShowDialog(); if (form2.groupName != "") { TreeNode tn = new TreeNode(); tn.Text = form2.groupName; treeView1.Nodes.Add(tn); if (treeView1.SelectedNode.Parent == null) { TreeXML tx = new TreeXML(); tx.AddXmlNode(starpath + @"\List.xml", form2.groupName); } } }
private void toolStripButton1_Click(object sender, EventArgs e) { Form2 form2 = new Form2(); form2.ShowDialog(); //弹出添加修改分组窗体 if (form2.groupName != "") { TreeNode tn = new TreeNode(); tn.Text = form2.groupName; treeView1.Nodes.Add(tn); /*写入XML文件*/ if (treeView1.SelectedNode.Parent == null) //判断是否是父节点 { TreeXML TreXml = new TreeXML(); TreXml.AddXmlNode(starpath + @"\List.xml", form2.groupName); } } }
private void toolStripButton1_Click(object sender, EventArgs e) //添加同级分组 { Form2 form2 = new Form2(); form2.ShowDialog(); //弹出添加修改分组窗体 if (form2.groupName != "") //如果输入的组名不为空 { TreeNode tn = new TreeNode(); //新建一个树节点 tn.Text = form2.groupName; //为该树节点赋值 treeView1.Nodes.Add(tn); //将新创建的树节点添加到树节点集合的末尾 /*写入XML文件*/ if (treeView1.SelectedNode.Parent == null) //判断是否是父节点 { TreeXML TreXML = new TreeXML(); TreXML.AddXmlNode(starpath + @"\List.xml", form2.groupName); //starpath为文件路径,form2.groupName为所添加分组的组名 } } }