日期:2014-05-18 浏览次数:21465 次
private void button1_Click(object sender, EventArgs e) { //禁用第一个节点 treeView1.Nodes[0].ForeColor = SystemColors.Control; } private void treeView1_BeforeSelect(object sender, TreeViewCancelEventArgs e) { if (e.Node != null) { if (e.Node.ForeColor == SystemColors.Control) { e.Cancel = true; //不让选中禁用节点 } } } private void treeView1_BeforeCheck(object sender, TreeViewCancelEventArgs e) { if (e.Node != null) { if (e.Node.ForeColor == SystemColors.Control) { e.Cancel = true; //不让选中禁用节点 } } }