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, MonteCarloMethod d) { this.a = a; this.b = b; this.quantity = (int)quantity; interval = (b - a) / this.quantity; d.EventPoints += OnPoints; d.EventNeedPoints += OnNeedPoints; d.EventProgress += OnProgress; d.EventFinish += OnFinish; d.EventTime += OnTime; this.d2 = d; f.Hide(); g = f; InitializeComponent(); }