Exemple #1
0
        private void rbtn_run_Click(object sender, EventArgs e)
        {
            this.panel1.Controls.Clear();//清除面板
            switch (((Button)sender).Name)
            {
            case "rbtn_run":
                form_sel(((Button)sender).Name);
                break;

            case "rbtn_product":
                if (frproduct == null)
                {
                    frproduct = new FrProduct();
                }
                //switch (frproduct.ctb_product.SelectedTab != null ? frproduct.ctb_product.SelectedTab.Name : "")
                //{
                //    case "tb_tg_cfg":
                //        form_sel(((RadioButton)sender).Name, frproduct.ctb_product.SelectedTab.Name);
                //        break;
                //    case "tb_tg_vs":
                //        form_sel(((RadioButton)sender).Name, frproduct.ctb_product.SelectedTab.Name);
                //        break;
                //    case "tb_ofs":
                //        form_sel(((RadioButton)sender).Name, frproduct.ctb_product.SelectedTab.Name);
                //        break;
                //    default:
                //        form_sel(((RadioButton)sender).Name, frproduct.ctb_product.SelectedTab.Name);
                //        break;
                //}
                form_sel(((Button)sender).Name);
                break;

            case "rbtn_sys":
                if (frsys == null)
                {
                    frsys = new FrSys();
                }
                //form_sel(((RadioButton)sender).Name, frsys.ctb_sys.SelectedTab.Name);
                form_sel(((Button)sender).Name);
                break;

            case "rbtn_count":
                form_sel(((Button)sender).Name);
                break;

            default:
                form_sel(((Button)sender).Name);
                break;
            }
        }
Exemple #2
0
        public void form_sel(string btn_name, string page_name = "", string page_name2 = "")
        {
            //    if (frrun != null) frrun.timer_update.Enabled = false;
            //    if (frsys != null) frsys.timer_update.Enabled = false;

            Font ft = new Font("Microsoft Sans Serif", 18, FontStyle.Bold);

            rbtn_run.Font     = ft;
            rbtn_product.Font = ft;
            rbtn_sys.Font     = ft;
            //  rbtn_count.Font = ft;

            rbtn_run.ForeColor     = Color.DarkGray;
            rbtn_product.ForeColor = Color.DarkGray;
            rbtn_sys.ForeColor     = Color.DarkGray;
            //  rbtn_count.ForeColor = Color.DarkGray;

            rbtn_run.BackColor     = Color.Transparent;
            rbtn_product.BackColor = Color.Transparent;
            rbtn_sys.BackColor     = Color.Transparent;
            //    rbtn_count.BackColor = Color.Transparent;

            Form form = null;

            ft = new Font("Microsoft Sans Serif", 22, FontStyle.Bold);

            //if (frsys == null) frsys = new FrSys();
            if (frsys != null)
            {
                frsys.bupdate = false;
            }
            //if (frrst == null) frrst = new FrRst();
            if (frrst != null)
            {
                frrst.bupdate = false;
            }
            //if (frproduct == null) frproduct = new FrProduct();
            if (frproduct != null)
            {
                frproduct.bupdate = false;
            }
            //if (frrun == null) frrun = new FrRun();
            if (frrun != null)
            {
                frrun.bupdate = false;
            }

            switch (btn_name)
            {
            case "rbtn_run":
                //  rbtn_run.Checked = true;
                rbtn_run.ForeColor = Color.WhiteSmoke;
                rbtn_run.Font      = ft;
                if (frrun == null)
                {
                    frrun = new FrRun();
                }
                form          = frrun;
                frrun.bupdate = true;
                //    foreach (Cam cam in COM.ListCam) cam.mCogRecDisplay = frrun.cogDisplayer_run.cogRecordDisplay;
                break;

            case "rbtn_product":
                //  rbtn_product.Checked = true;
                rbtn_product.ForeColor = Color.WhiteSmoke;
                rbtn_product.Font      = ft;
                if (frproduct == null)
                {
                    frproduct = new FrProduct();
                }
                form = frproduct;
                frproduct.bupdate = true;
                //   foreach (Cam cam in COM.ListCam) cam.mCogRecDisplay = frproduct.cogDisplayer_product.cogRecordDisplay;
                ////page select
                //if (frproduct.ctb_prodcut.TabPages[page_name] != null) frproduct.ctb_prodcut.TabPages[page_name].Select();
                //if (page_name == "tb_tg_cfg")
                //{
                //    //VisionRun.Display = new VisionDisplay(frproduct.cogRecordDisplay_live, "");
                //    if (frproduct.ctb_tg_view.TabPages[page_name2] != null) frproduct.ctb_tg_view.TabPages[page_name2].Select();
                //}
                //else if (page_name == "tb_tg_vs")
                //{
                //    //VisionRun.Display = new VisionDisplay(frproduct.DisPlayAndImageMask1.CogRecordDisplay, "");
                //    if (frproduct.ctb_vs_cfg.TabPages[page_name2] != null) frproduct.ctb_vs_cfg.TabPages[page_name2].Select();
                //}
                //else if (page_name == "tb_ofs")
                //{
                //    //VisionRun.Display = new VisionDisplay(frproduct.cogRecordDisplay_ofs, "");
                //    if (frproduct.ctb_ofs.TabPages[page_name2] != null) frproduct.ctb_ofs.TabPages[page_name2].Select();
                //}
                break;

            case "rbtn_count":
                //rbtn_count.Checked = true;
                rbtn_count.ForeColor = Color.WhiteSmoke;
                rbtn_count.Font      = ft;
                if (frcount == null)
                {
                    frcount = new FrCount();
                }
                form = frcount;
                break;

            case "rbtn_sys":
                //  rbtn_sys.Checked = true;
                rbtn_sys.ForeColor = Color.WhiteSmoke;
                rbtn_sys.Font      = ft;
                if (frsys == null)
                {
                    frsys = new FrSys();
                }
                form          = frsys;
                frsys.bupdate = true;
                //   foreach (Cam cam in COM.ListCam) cam.mCogRecDisplay = frsys.CogRecordDisplay_sys.cogRecordDisplay;
                ////page select
                //if (frsys.ctb_sys.TabPages[page_name] != null) frsys.ctb_sys.TabPages[page_name].Select();
                //if (page_name == "tb_cali")
                //{
                //    if (frsys.ctb_cali.TabPages[page_name2] != null) frsys.ctb_cali.TabPages[page_name2].Select();
                //}
                //frsys.timer_update.Enabled = true;
                //if (VisionRun.Display.m_strName != "frsysCogRecordDisplay")
                //    VisionRun.Display = new VisionDisplay(frsys.CogRecordDisplay, "frsysCogRecordDisplay");
                break;
            //case "rbtn_user":
            //    rbtn_user.Checked = true;
            //    rbtn_user.ForeColor = Color.WhiteSmoke;
            //    rbtn_user.Font = ft;
            //    if (frsuser == null) frsuser = new FrUser();
            //    form = frsuser;
            //    break;

            //case "rbtn_rst":
            //    rbtn_rst.Checked = true;
            //    rbtn_rst.ForeColor = Color.WhiteSmoke;
            //    rbtn_rst.Font = ft;
            //    if (frrst == null) frrst = new FrRst();
            //    form = frrst;
            //    frrst.bupdate = true;
            //    break;
            default:
                break;
            }

            if (form == null)
            {
                return;
            }
            //  pnl_sub.Controls.Clear();
            form.TopLevel        = false;
            form.FormBorderStyle = FormBorderStyle.None;
            form.Dock            = DockStyle.Fill;
            //  this.panel1.Controls.Add(form);
            form.Parent = this.panel1;



            //    pnl_sub.Controls.Add(form);

            //form.Width = pnl_sub.Width;
            //form.Height = pnl_sub.Height - 8;
            form.Show();
        }