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;
            }
        }
        private void MainWnd_Load(object sender, EventArgs e)
        {
            bIsReceiving = true;
            //初始化该线程并指定线程执行时要调用的方法
            thread1 = new Thread(new ThreadStart(ReceiveMessages));
            //启动线程
            thread1.Start();
            //treeView1.BeginUpdate();
            //treeView1.Nodes.Clear();
            //treeView1.Nodes.Add("Parent");
            //treeView1.Nodes[0].Nodes.Add("Child1");
            //treeView1.Nodes[0].Nodes.Add("Child2");
            //treeView1.Nodes[0].Nodes[1].Nodes.Add("Grandchild");
            //treeView1.Nodes[0].Nodes[1].Nodes[0].Nodes.Add("Great Grandchild");
            //treeView1.EndUpdate();

            treeView1.BeginUpdate();
            treeView1.Nodes.Clear();
            treeView1.ImageList = imageList1;
            treeView1.ImageIndex = 0;
            treeView1.SelectedImageIndex = 1;

            treeView1.Nodes.Add("基本资料");
            treeView1.Nodes[0].ImageIndex = 2;
            treeView1.Nodes[0].SelectedImageIndex = 3;
            treeView1.Nodes[0].Nodes.Add("资产登记");
            treeView1.Nodes[0].Nodes.Add("类别维护");
            treeView1.Nodes[0].Nodes.Add("人员维护");
            treeView1.Nodes[0].Nodes.Add("地点维护");
            //权限
            if (Login.sRole != "系统管理员" && Login.sRole != "资产管理员")
            {
                treeView1.Nodes[0].ForeColor = System.Drawing.Color.Gray;
                treeView1.Nodes[0].Nodes[0].ForeColor = System.Drawing.Color.Gray;
                treeView1.Nodes[0].Nodes[1].ForeColor = System.Drawing.Color.Gray;
                treeView1.Nodes[0].Nodes[2].ForeColor = System.Drawing.Color.Gray;
                treeView1.Nodes[0].Nodes[3].ForeColor = System.Drawing.Color.Gray;
            }

            treeView1.Nodes.Add("资产管理");
            treeView1.Nodes[1].ImageIndex = 2;
            treeView1.Nodes[1].SelectedImageIndex = 3;
            treeView1.Nodes[1].Nodes.Add("领用管理");
            treeView1.Nodes[1].Nodes.Add("使用管理");
            treeView1.Nodes[1].Nodes.Add("资产注销");
            //权限
            if (Login.sRole != "系统管理员" && Login.sRole != "资产管理员")
            {

                if (Login.sRole != "实验室管理员")
                {
                    treeView1.Nodes[1].ForeColor = System.Drawing.Color.Gray;
                    treeView1.Nodes[1].Nodes[1].ForeColor = System.Drawing.Color.Gray;
                }
                treeView1.Nodes[1].Nodes[0].ForeColor = System.Drawing.Color.Gray;
                treeView1.Nodes[1].Nodes[2].ForeColor = System.Drawing.Color.Gray;
            }

            treeView1.Nodes.Add("资产盘点");
            treeView1.Nodes[2].ImageIndex = 2;
            treeView1.Nodes[2].SelectedImageIndex = 3;
            treeView1.Nodes[2].Nodes.Add("创建清单");
            treeView1.Nodes[2].Nodes.Add("清单查询");
             //权限
            if (Login.sRole != "系统管理员" && Login.sRole != "资产管理员")
            {
                treeView1.Nodes[2].ForeColor = System.Drawing.Color.Gray;
                treeView1.Nodes[2].Nodes[0].ForeColor = System.Drawing.Color.Gray;
                treeView1.Nodes[2].Nodes[1].ForeColor = System.Drawing.Color.Gray;
            }

            treeView1.Nodes.Add("查询统计");
            treeView1.Nodes[3].ImageIndex = 2;
            treeView1.Nodes[3].SelectedImageIndex = 3;
            treeView1.Nodes[3].Nodes.Add("资产查询");
            treeView1.Nodes[3].Nodes.Add("资产历史");
            treeView1.EndUpdate();

            AddLog("----欢迎使用!----");
            AddLog("<双击清空>");

            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;
        }