zoukankan      html  css  js  c++  java
  • 节点的增加,删除,修改

    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)
            {
               
              
                }
           
        }
    }

  • 相关阅读:
    【转】最奇特的编程语言特征
    【原】mysql 视图
    自己动手写ORM框架(一):目标效果预览
    (二)Javascript面向对象:命名空间
    在JAVA中封装JSONUtils工具类及使用(一)
    .NET3.5中JSON用法以及封装JsonUtils工具类(二)
    (四)Javascript面向对象:继承
    自己动手写ORM框架(三):关系映射配置—Table属性
    (一)javascript面向对象:(2)类
    自己动手写ORM框架(二):AdoHelper支持多数据库操作的封装(1)
  • 原文地址:https://www.cnblogs.com/1234wwww/p/6590442.html
Copyright © 2011-2022 走看看