我有每个节点标记包含表单名称的树视图,当我单击节点时我打开表单我的代码如下
private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
{
NodeClick(Convert.ToString(e.Node.Tag));
}
public void NodeClick(string formName)
{
switch (formName)
{
case "frmPartMaster":
frmPartMaster partMaster = null;
if ((partMaster =
(frmPartMaster)Globale.IsFormAlreadyOpen(typeof(frmPartMaster)))
== null)
{
partMaster = new frmPartMaster();
partMaster.Show(this);
}
else
{
partMaster.Activate();
partMaster.WindowState = FormWindowState.Normal;
partMaster.BringToFront();
}
break;
}
}
这段代码工作正常,但我有 1000 个表格,对于每个表格,我必须正确区分代码。如果我通过它打开它的表格,是否有可能像在单一情况下一样打开它?