コード例 #1
0
        /// <summary>
        /// 选择一个单视觉示教助手
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void OnSelectSingleVisionAssist(object sender, EventArgs e)
        {
            ToolStripMenuItem    mi    = sender as ToolStripMenuItem;
            JFSingleVisionAssist sva   = JFHubCenter.Instance.VisionMgr.GetSVAssistByName(mi.Text);
            JFRealtimeUI         newUc = sva.GetRealtimeUI();

            //if (panelSingleVA.Controls.Contains(newUc))
            //    return;
            if (tpSingleVisionTeach.Controls.Contains(newUc))
            {
                return;
            }
            foreach (Control ctrl in tpSingleVisionTeach.Controls)
            {
                if (ctrl is JFRealtimeUI)
                {
                    tpSingleVisionTeach.Controls.Remove(ctrl);
                    ctrl.Visible = false;
                    break;
                }
            }
            //tpSingleVisionTeach.Controls.Clear();
            //newUc.Dock = DockStyle.Fill;
            newUc.Top = menuStrip1.Bottom;
            tpSingleVisionTeach.Controls.Add(newUc);
            //panelSingleVA.Controls.Add(newUc);
            //newUc.Dock = DockStyle.Fill;
            newUc.Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;

            newUc.Visible = true;
        }