我有这个树视图菜单
使用此代码:
TreeNode treeNode4 = new TreeNode("Importação CT-I", array5);
treeView1.Nodes.Add(treeNode4);
TreeNode nodeusu1 = new TreeNode("Usuários");
TreeNode nodeusu2 = new TreeNode("Servers");
TreeNode nodeusu3 = new TreeNode("Permissões");
TreeNode nodeusu4 = new TreeNode("Alterar Senha");
TreeNode nodeusu5 = new TreeNode("Sobre");
TreeNode nodeusu6 = new TreeNode("Encerrar");
TreeNode[] array6 = new TreeNode[] { nodeusu1, nodeusu2, nodeusu3, nodeusu4, nodeusu5, nodeusu6 };
private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
if (treeView1.SelectedNode.Text == "Grupo")
{
frm_grupo grupo = new frm_grupo();
grupo.TopLevel = false;
grupo.AutoScroll = true;
panelmain.Controls.Add(grupo);
grupo.Show();
}
else if (treeView1.SelectedNode.Text == "Servers")
{
Conecta Servidor = new Conecta();
Servidor.TopLevel = false;
Servidor.AutoScroll = true;
panelmain.Controls.Add(Servidor);
Servidor.Show();
Servidor.BringToFront();
}
}
所有节点都工作正常,但节点“服务器”只工作一次,如果我更改为另一个节点,节点“服务器”不再工作,我做错了什么?
Conecta 是一个 Windows 窗体,具有与窗体相同的命名空间。汉斯,但我把 dispose() 放在哪里???我添加了 brintofront() 正在工作,但是我把 dispose() 放在最后一个关闭的地方