/// <summary> /// 增加新的分类 /// </summary> /// <param name="sender">事件发送者</param> /// <param name="e">事件</param> private void buttonX3_Click(object sender, EventArgs e) { TypeForm tf = new TypeForm(); DialogResult result = tf.ShowDialog(); if (result == DialogResult.OK) { foreach (TreeNode node in treeView1.Nodes) { if (node.Text == tf.TypeName) { MessageBox.Show("该分类已经存在!"); return; } } TreeNode node1 = treeView1.Nodes.Add(tf.TypeName); node1.ImageIndex = 0; node1.SelectedImageIndex = 0; } }
/// <summary> /// 增加新的分类 /// </summary> /// <param name="sender">事件发送者</param> /// <param name="e">事件</param> private void buttonX3_Click(object sender, EventArgs e) { TypeForm tf = new TypeForm(); DialogResult result = tf.ShowDialog(); if(result == DialogResult.OK) { foreach(TreeNode node in treeView1.Nodes) { if(node.Text == tf.TypeName) { MessageBox.Show("该分类已经存在!"); return; } } TreeNode node1 = treeView1.Nodes.Add(tf.TypeName); node1.ImageIndex = 0; node1.SelectedImageIndex = 0; } }