我的问题是我想能够设置某些节点不可见。我有两种形式。第二个填充女巫复选框与第一种形式的节点相同。在选中其中一个复选框后,我想让这个节点以第一种形式隐形。在表单之间传递数据是可行的,因为我使用MessageBox对其进行了测试。使某个节点不可见
从第二种形式的代码(Responslibe制作节点隐形):从第一种形式
private void button1_Click(object sender, EventArgs e)
{
if (checkBox1.Checked == true)
{
Form1.a = true;
}
this.Close();
}
代码包含节点:
public static bool a;
public static bool b;
private void Categories()
{
if(a == true)
{
treeView1.Nodes[0].IsVisible = false;
}
}
错误,我得到:
Property or indexer 'System.Windows.Forms.TreeNode.IsVisible' cannot be assigned to -- it is read only
东西因为'IsVisible'是一个只读属性。 –
可能的重复http://stackoverflow.com/questions/1199417/how-do-i-make-a-treenode-not-visible-c –