Beispiel #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            var frm = new frmPointsGen();

            if (frm.ShowDialog() == DialogResult.OK)
            {
                GenPoints             = frm.GeneratePoints(ref FuncNumber);
                Graphic.Funcs[0].Func = frm.GetFunc(FuncNumber);
                dgvPointsTable.Rows.Clear();
                for (int i = 0; i < GenPoints.Count; i++)
                {
                    dgvPointsTable.Rows.Add(new object[] { GenPoints[i].X.ToString(FloatResultFormat),
                                                           GenPoints[i].Y.ToString(FloatResultFormat),
                                                           1 });
                    dgvPointsTable.Rows[i].HeaderCell.Value = i;
                }
                btnUpdate_Click(sender, e);
                tbBottomBound.Text = GenPoints[0].X.ToString(FloatResultFormat);
                tbUpperBound.Text  = GenPoints[GenPoints.Count - 1].X.ToString(FloatResultFormat);
            }
        }
Beispiel #2
0
        void LoadGenPoints()
        {
            dgvPointsTable.Rows.Clear();
            GenPoints = new List <PointD>();
            frmPointsGen frm    = new frmPointsGen();
            StreamReader Reader = new StreamReader("Settings.dat");

            //Graphic.Funcs = new GraphFunc[2];
            Graphic.Funcs[0].Func = frm.GetFunc(Convert.ToInt32(Reader.ReadLine()));
            while (!Reader.EndOfStream)
            {
                GenPoints.Add(new PointD(Convert.ToDouble(Reader.ReadLine()), Convert.ToDouble(Reader.ReadLine())));
                Reader.ReadLine();  // веса
                dgvPointsTable.Rows.Add(new object[] { GenPoints[GenPoints.Count - 1].X.ToString(FloatResultFormat),
                                                       GenPoints[GenPoints.Count - 1].Y.ToString(FloatResultFormat),
                                                       1 });
                dgvPointsTable.Rows[dgvPointsTable.Rows.Count - 1].HeaderCell.Value = dgvPointsTable.Rows.Count - 1;
            }

            Reader.Close();
        }