• 节点的增加,删除,修改


    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;

    namespace Tree
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
          
            private void button1_Click(object sender, EventArgs e)
            {
                string type = textBox1.Text.Trim();
                TreeNode rootNode;
                rootNode = this.treeView1.Nodes.Add(type);
            }

            private void button2_Click(object sender, EventArgs e)
            {
                if(this.textBox1.Text!=string.Empty){
                    string type = textBox1.Text.Trim();
                    treeView1.SelectedNode.Nodes.Add(type);
                    treeView1.ExpandAll();
                }

              
            }

            private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)
            {
                TreeNode type = treeView1.SelectedNode;
                type.Remove();
            }

            private void 修改ToolStripMenuItem_Click(object sender, EventArgs e)
            {
              
                if(this.treeView1.SelectedNode!=null){
                    treeView1.SelectedNode.Text = textBox1.Text;
                    if(this.treeView1.SelectedNode.Text!=null&&this.treeView1.Nodes.Count==0){
                        TreeNode type = new TreeNode();
                        treeView1.ExpandAll();
                    }
                }
            }

            private void button3_Click(object sender, EventArgs e)
            {
               
              
                }
           
        }
    }

  • 相关阅读:
    jvm 优化
    SqlServer体系结构
    sqlserver2012 在视图中建索引
    win10 桌面设置为远程桌面
    ORACLE 查询某表中的某个字段的类型,是否为空,是否有默认值等
    activemq读取剩余消息队列中消息的数量
    Oracl 一条sql语句 批量添加、修改数据
    ClickOnce一项Winform部署
    C#语言中的修饰符
    关于MySQL集群的一些看法
  • 原文地址:https://www.cnblogs.com/1234wwww/p/6590442.html
Copyright © 2020-2023  润新知