Пример #1
0
        public void AddNewTabWithExperiment(Experiment c)
        {
            ExperimentControl p = new ExperimentControl();
            p.Name = "ExpCtrl";
            p.LoadExperiment(c);

            p.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;

            p.Size = Tabs.Size;
            p.Left = Tabs.Left;
            p.Top = Tabs.Top - 25;

            Size _Size = p.Size;
            _Size.Width -= 202;
            _Size.Height -= 26;
            //p.Size = _Size;
            p.Experiment.Graphics.SetDrawingBorder(p.Left, p.Top, _Size);

            //���������� ���� ������������
            switch (p.Experiment.Graphics.Needs)
            {
                case ExperimentNeeds.None: break;
                case ExperimentNeeds.Normal: break; //���������� ����������
                case ExperimentNeeds.ZedGraph:
                    //�������� ��������
                    ZedGraph.ZedGraphControl zgc = new ZedGraph.ZedGraphControl();
                    zgc.Size = _Size;
                    p.Controls.Add(zgc);
                    GraphPane zgcPane = zgc.GraphPane;
                    zgcPane.Chart.Fill = new Fill(Color.White, Color.LightBlue, 45.0F);
                    p.Experiment.Graphics.CreateControl(zgc); //�������� ������� Zedgraph'�
                    break;

                case ExperimentNeeds.XNA: break;//�������� 3�-�����
                case ExperimentNeeds.Graph:
                        ZedGraphControl graph = new ZedGraphControl();
                        graph.Size = _Size;
                        p.Controls.Add(graph);

                        GraphPane myPane;
                        /*graph.Top = 0;
                        graph.Left = 0;
                        graph.Height = this.Height;
                        graph.Width = this.Width;
                        */
                        myPane = graph.GraphPane;
                        p.Experiment.Graphics.SetGraphInfo(myPane);
                        myPane.Legend.IsVisible = false;
                        myPane.Chart.Fill = new Fill(Color.White, Color.LightBlue, 45.0F);
                        break;
                case ExperimentNeeds.OpenGL:
                        SimpleOpenGlControl tao_ctrl = new SimpleOpenGlControl();
                        tao_ctrl.Size = _Size;
                        tao_ctrl.Name = "TaoControl";
                        p.Controls.Add(tao_ctrl);
                        tao_ctrl.MouseDown += p.OGL_MouseDown;
                        tao_ctrl.MouseUp += p.OGL_MouseUp;
                        tao_ctrl.MouseMove += p.OGL_MouseMove;
                        //tao_ctrl.MouseWheel += p.OGL_MouseWheel;
                        tao_ctrl.KeyDown += p.OGL_KeyDown;

                        tao_ctrl.InitializeContexts();
                        break;
            }

            p.LoadParameters(p.Experiment.Graphics.ParameterListTemplate);
            //    p.Experiment.pList = p.Experiment.Graphics.ParameterListTemplate;

            p.Experiment.Graphics.SetParameters(p.Experiment.Graphics.ParameterListTemplate);
            p.Anchor = AnchorStyles.Bottom & AnchorStyles.Right & AnchorStyles.Top & AnchorStyles.Left;

            Tabs.TabPages.Add("exp" + ExperimentCount, "����������� " + ExperimentCount);
            Tabs.TabPages[ExperimentCount].Controls.Add(p);
            Tabs.SelectTab(ExperimentCount);
            Tabs.TabPages[ExperimentCount].Focus();

            ExperimentCount++;
        }
Пример #2
0
        private void statsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ExperimentList expsList = new ExperimentList();
            ExperimentInfo expinf = new ExperimentInfo();
            foreach (TabPage tab in Tabs.TabPages)
            {
                if (tab.Text == "��������� ��������") continue;
                expinf = new ExperimentInfo("", ((ExperimentControl)tab.Controls.Find("ExpCtrl", true)[0]).Experiment.Graphics);
                //expinf.GraphicsObj = ((ExperimentControl)tab.Controls.Find("ExpCtrl", true)[0]).Experiment.Graphics;
                bool k = false;
                foreach (ExperimentInfo e_i in expsList.eList)
                {
                    if (e_i.GraphicsObj == expinf.GraphicsObj) k = true;
                }
                if (!k) expsList.eList.Add(expinf);
            }
            ExpStats c = new ExpStats(expsList, ref this.Tabs);

            if (c.ShowDialog() != DialogResult.Cancel)
            {
                ExperimentControl p = new ExperimentControl();
                p.Experiment = c.ExperimentObject;

                Tabs.TabPages.Add("exp" + ExperimentCount, "����������� " + ExperimentCount);
                Tabs.TabPages[ExperimentCount].Controls.Add(p);
                Tabs.TabPages[ExperimentCount].Focus();

                ExperimentCount++;

            }
        }