我的問題是我想能夠設置某些節點不可見。我有兩種形式。第二個填充女巫複選框與第一種形式的節點相同。在選中其中一個複選框後,我想讓這個節點以第一種形式隱形。在表單之間傳遞數據是可行的,因爲我使用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 –