Beispiel #1
0
 void btnCalc_Click(object sender, EventArgs e)
 {
     try
     {
         string   report;
         double   sT = double.Parse(tbSTOld.Text), E = double.Parse(tbE.Text);
         string[] arrEl = new string[dgvEl.Rows.Count - 1];
         double[] arrC  = new double[dgvEl.Rows.Count - 1];
         for (int i = 0; i < dgvEl.Rows.Count - 1; i++)
         {
             arrEl[i] = dgvEl[0, i].Value.ToString();
             arrC[i]  = double.Parse(dgvEl[1, i].Value.ToString());
         }
         double aT, bT, aP, bP, aH, bH;
         Steel.SetGroup(arrEl, arrC, out aT, out bT, out aP, out bP, out aH, out bH, out report);
         string rep;
         Steel.Calculate(arrEl, arrC, sT, E, "e", "ПТ", E, out rep);
         report += "<br>" + rep;
         Steel.Calculate(arrEl, arrC, sT, E, "e", "ПП", E, out rep);
         report += "<br>" + rep;
         Steel.Calculate(arrEl, arrC, sT, E, "e", "HB", E, out rep);
         report          += "<br>" + rep;
         wbS.DocumentText = report;
     }
     catch { }
 }
Beispiel #2
0
        void btnGraph_Click(object sender, EventArgs e)
        {
            try
            {
                double   sT = double.Parse(tbSTOld.Text), E = double.Parse(tbE.Text);
                string[] arrEl = new string[dgvEl.Rows.Count - 1];
                double[] arrC  = new double[dgvEl.Rows.Count - 1];
                for (int i = 0; i < dgvEl.Rows.Count - 1; i++)
                {
                    arrEl[i] = dgvEl[0, i].Value.ToString();
                    arrC[i]  = double.Parse(dgvEl[1, i].Value.ToString());
                }

                PForm pf = new PForm(arrEl);
                if (pf.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                int      n    = 30;
                double[] arrX = new double[n], arrY = new double[n];
                double   step = (pf.max - pf.min) / (n - 1);
                string   rep;
                for (int i = 0; i < arrX.Length; i++)
                {
                    arrX[i] = pf.min + step * i;
                    arrY[i] = Steel.Calculate(arrEl, arrC, sT, E, pf.x, pf.y, arrX[i], out rep);
                }
                GForm gf = new GForm(pf.x, pf.y, arrX, arrY);
                gf.Show();
            }
            catch { }
        }
Beispiel #3
0
        public MainForm()
        {
            InitializeComponent();
            (dgvF.Columns[1] as DataGridViewComboBoxColumn).Items.AddRange(new string[] {
                "x", "x^2", "x^3", "1/x", "1/x^2", "sqrt(x)", "1/sqrt(x)", "ln(x)", "exp(x)"
            });
            List <string> lS = new List <string>(new string[] {
                "S", "C", "P", "Si", "Mg", "Mn", "Cu", "As", "Ni", "Cr", "N", "Mo", "V", "W", "Co"
            });

            lS.Sort();
            (dgvEl.Columns[0] as DataGridViewComboBoxColumn).Items.AddRange(lS.ToArray());
            Steel.Initialize();
        }