public void Bind(TreeNode node) { List <Mdl> drs = Mdls.FindAll(m => m.parentcode == ((Mdl)node.Tag).mdlcode); foreach (Mdl dr in drs) { var n = new TreeNode(); n.Tag = dr; n.Text = dr.form; node.Nodes.Add(n); this.Bind(n); } }
public void MdlInitialize() { treeView1.Nodes.Clear(); TreeNode tn1 = new TreeNode("0"); Mdl mdl = Mdls.Single(m => m.parentcode == "0"); tn1.Tag = mdl; tn1.Text = mdl.form; treeView1.Nodes.Add(tn1); this.Bind(tn1); treeView1.Font = new Font("宋体", 15, FontStyle.Bold); treeView1.ExpandAll(); }