private void treeView1_DoubleClick(object sender, EventArgs e) { if (curForm != null) { curForm.Close(); curForm = null; } AddLog(treeView1.SelectedNode.Text); if (treeView1.SelectedNode.Text.Equals("资产登记")) { // MessageBox.Show(treeView1.SelectedNode.Text.ToString()); splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 AssInput obj = new AssInput(this); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; //AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; //obj.Dock = DockStyle.Fill; obj.Show(); curForm = obj; } else if(treeView1.SelectedNode.Text.Equals("资产管理")) { splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 AssSupply obj = new AssSupply(this); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. //obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; obj.Show(); curForm = obj; } else if(treeView1.SelectedNode.Text.Equals("资产历史")) { splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 QryAssLog obj = new QryAssLog(this); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. //obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; obj.Show(); curForm = obj; } else if (treeView1.SelectedNode.Text.Equals("资产盘点")) { splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 InvList obj = new InvList(this); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. //obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; obj.Show(); curForm = obj; } }
private void treeView1_DoubleClick(object sender, EventArgs e) { if (curForm != null) { curForm.Close(); curForm = null; } // AddLog(treeView1.SelectedNode.Text); string sCurNode = treeView1.SelectedNode.Text; if (treeView1.SelectedNode.ForeColor == System.Drawing.Color.Gray) { sCurNode = ""; } if (sCurNode.Equals("资产登记")) { splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 AssInput obj = new AssInput(this); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. //obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; obj.Show(); curForm = obj; } else if (sCurNode.Equals("类别维护")) { splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 CatList obj = new CatList(this); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. //obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; obj.Show(); curForm = obj; } else if (sCurNode.Equals("人员维护")) { splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 EmpList obj = new EmpList(this); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. //obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; obj.Show(); curForm = obj; } else if (sCurNode.Equals("地点维护")) { splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 AddrList obj = new AddrList(this); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. //obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; obj.Show(); curForm = obj; } else if (sCurNode.Equals("领用管理")) { splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 AssSupply obj = new AssSupply(this); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. //obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; obj.Show(); curForm = obj; } else if (sCurNode.Equals("使用管理")) { splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 AssUse obj = new AssUse(this); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. //obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; obj.Show(); curForm = obj; } else if (sCurNode.Equals("资产注销")) { splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 AssLogoff obj = new AssLogoff(this); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. //obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; obj.Show(); curForm = obj; } else if (sCurNode.Equals("资产查询")) { splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 QryAssList obj = new QryAssList(this); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. //obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; obj.Show(); curForm = obj; } else if(sCurNode.Equals("资产历史")) { splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 QryAssLog obj = new QryAssLog(this); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. //obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; obj.Show(); curForm = obj; } else if (sCurNode.Equals("创建清单")) { splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 InvList obj = new InvList(this); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. //obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; obj.Show(); curForm = obj; } else if (sCurNode.Equals("清单查询")) { splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 InvListQry obj = new InvListQry(this); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. //obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; obj.Show(); curForm = obj; } else { splitContainer1.Panel2.Controls.Clear();//这里是清空panel2中的控件的。 Welcome obj = new Welcome(); obj.TopLevel = false; obj.MdiParent = this;//这句代码也要写上,否则会出错。 obj.Parent = splitContainer1.Panel2; //Form3的parent是panel2. //obj.textBoxLog = textBoxLog; obj.FormBorderStyle = FormBorderStyle.None; obj.WindowState = FormWindowState.Maximized; obj.BringToFront(); obj.Anchor = AnchorStyles.Left | AnchorStyles.Top; obj.Show(); curForm = obj; } }