private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { if (numA.Value < numB.Value) { if (listBox1.SelectedIndex == 0) { MidpointMethod s = new MidpointMethod((double)numA.Value, (double)numB.Value, (double)numQ.Value); gr = new Graph(this, (double)numA.Value, (double)numB.Value, (double)numQ.Value, s); gr.Show(); } if (listBox1.SelectedIndex == 1) { SimpsonsMethod s = new SimpsonsMethod((double)numA.Value, (double)numB.Value, (double)numQ.Value); gr = new Graph(this, (double)numA.Value, (double)numB.Value, (double)numQ.Value, s); gr.Show(); } if (listBox1.SelectedIndex == 2) { MonteCarloMethod s = new MonteCarloMethod((double)numA.Value, (double)numB.Value, (double)numQ.Value); gr = new Graph(this, (double)numA.Value, (double)numB.Value, (double)numQ.Value, s); gr.Show(); } } else { label2.Text = "ErRoR"; } }
public Graph(Get_Data f, double a, double b, double quantity, SimpsonsMethod d) { this.a = a; this.b = b; this.quantity = (int)quantity; interval = (double)(b - a) / this.quantity; d.EventSpline += OnSpline1; d.EventProgress += OnProgress; d.EventFinish += OnFinish; d.EventTime += OnTime; this.d1 = d; f.Hide(); g = f; InitializeComponent(); }