private void Form1_Load(object sender, EventArgs e)
{
//运行看看
TreeNode root = new TreeNode();
root.Text = "root";
treeView1.Nodes.Add(root);
TreeNode n11 = new TreeNode("11");
root.Nodes.Add(n11);
n11.Nodes.Add(new TreeNode("21"));
n11.Nodes.Add(new TreeNode("22"));
treeView1.CheckBoxes = true;
treeView1.ExpandAll();
}
string _key = "123";
string strObjName= "abc";
//设置树节点显示复选框
trvStructure.CheckBoxes=true;
//添加根节点
trvStructure.Nodes.Add(_key, strObjName);
trvStructure.Nodes[0].Tag = _key;
//添加子节点
string iPapaID="111";
trvStructure.Nodes.Find(iPapaID, true)[0].Nodes.Add(_key, strObjName);
trvStructure.Nodes.Find(iPapaID, true)[0].Nodes[_key].Tag = _key;