private void button1_Click(object sender, EventArgs e) { double q; Random random = new Random(); Value coordinate = new Value(); F1 f1; F2 f2; if (Check()) { f1 = new F1(); f2 = new F2(); double xMin = Convert.ToDouble(textBoxXMin.Text); double xMax = Convert.ToDouble(textBoxXMax.Text); double dx = Convert.ToDouble(textBoxDx.Text); double a = Convert.ToDouble(textBoxA.Text); progressBar.Step = (int)((xMax - xMin) / dx); for (double i = xMin; i < xMax; i += dx) { q = random.NextDouble(); coordinate = new Value() { x = i, q = q, a = a }; if (q > 0 && q <= 0.7) { f1.Caculate(coordinate); } else { f2.Caculate(coordinate); } System.Threading.Thread.Sleep(1000); progressBar.PerformStep(); } f1.OutPutGrafic(); f2.OutPutGrafic(); } }