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 { } }
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 { } }