示例#1
0
        /// <summary>
        /// инициализатор плоттеров для рисования и накидываетль их на форму
        /// </summary>
        /// <param name="PlottersCount"></param>
        /// <param name="LeftTopCorner"></param>
        /// <param name="sys"></param>
        public void InitPlotters(int PlottersCount, Point LeftTopCorner, ESystem sys)
        {
            //метки панелей
            PanesLabels = new System.Windows.Forms.Label[PlottersCount + 1];
            for (int k = 0; k < PlottersCount + 1; k++)
            {
                PanesLabels[k]      = new System.Windows.Forms.Label();
                PanesLabels[k].Font = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            }
            PanesLabels[0].Text = "X";
            PanesLabels[1].Text = "U";
            PanesLabels[2].Text = "Y";
            PanesLabels[3].Text = "F (Quality)";
            //Создание панелей
            Panes = new StackedPlotters[PlottersCount];
            int i = 0;

            Panes[0] = new StackedPlotters(new Point(LeftTopCorner.X, LeftTopCorner.Y - PanesLabels[i].Height), new Size(100, 100), sys.current_state.x, Color.Green);
            i        = 1;
            Panes[1] = new StackedPlotters(new Point(LeftTopCorner.X + (100 + 10) * i, LeftTopCorner.Y - PanesLabels[i].Height), new Size(100, 100), sys.current_state.u, Color.Blue);
            i        = 2;
            Panes[2] = new StackedPlotters(new Point(LeftTopCorner.X + (100 + 10) * i, LeftTopCorner.Y - PanesLabels[i].Height), new Size(100, 100), sys.current_state.y, Color.Red);
            // И панели качества
            quality = new plotter(new Point(LeftTopCorner.X, LeftTopCorner.Y + 110), new Size(100, 100), Color.Red, sys.current_state.quality_f);
        }
示例#2
0
        public StackedPlotters(Point newLocation, Size newPSize, List <Matrix> Arr, Color C) : base()
        {
            Location  = newLocation;
            Size      = newPSize;
            BackColor = Color.LightSteelBlue;
            //оффсеты
            HeightOffsetPercent = 0.1;
            WidthOffsetPercent  = 0.1;
            //Ручка
            GridPen = new Pen(Color.Black, 1);
            //плоттеры
            Plot = new plotter[Arr[0].NoRows];
            for (int i = 0; i < Plot.Length; i++)
            {
                Plot[i] = new plotter(new Point(WidthOffset / 2, i * Size.Height / Plot.Length + HeightOffset / 2), new Size(Width - WidthOffset, Size.Height / Plot.Length - HeightOffset), C, Arr, i);
                this.Controls.Add(Plot[i]);
                this.BringToFront();
            }
            //Метки
            Y          = new System.Windows.Forms.Label();
            Y.Text     = "Y";
            Y.Font     = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            Y.Location = new Point(Convert.ToInt32(0.75 * WidthOffset), 0);
            Y.AutoSize = true;
            this.Controls.Add(Y);
            Y.SendToBack();
            X = new System.Windows.Forms.Label[this.Plot.Length];
            for (int i = 0; i < X.Length; i++)
            {
                X[i]          = new System.Windows.Forms.Label();
                X[i].Text     = "X";
                X[i].Font     = new System.Drawing.Font("Arial", 8F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
                X[i].Location = new Point(Width - WidthOffset / 2 - X[i].Width, Plot[i].Location.Y + Plot[i].Height + Convert.ToInt32(GridPen.Width));
                X[i].AutoSize = true;
                this.Controls.Add(X[i]);
                X[i].SendToBack();
            }


            //events
            this.SizeChanged += OnSizeChanged;
        }