public GraphSettingsDialog(GraphSettings _settings, FunctionGrapher _mainForm) { InitializeComponent(); this.checkBoxGrid.Checked = _settings.Grid; this.textBoxGridWidth.Text = _settings.GridWidth.ToString(); this.checkBoxSmoothGraph.Checked = _settings.SmoothGraph; this.comboBoxGraphType.Items.Add(GraphTypes.Function); this.comboBoxGraphType.Items.Add(GraphTypes.Derivative); this.comboBoxGraphType.Items.Add(GraphTypes.Slope); this.comboBoxGraphType.Items.Add(GraphTypes.VectorField); this.comboBoxGraphType.Items.Add(GraphTypes.LevelCurves); this.comboBoxGraphType.Items.Add(GraphTypes.LevelCurves2); this.comboBoxGraphType.Items.Add(GraphTypes.ParametricFamily); this.comboBoxGraphType.Items.Add(GraphTypes.ParametricFunction); this.comboBoxGraphType.Items.Add(GraphTypes.Iteration); this.comboBoxGraphType.Items.Add(GraphTypes.Cobweb); this.comboBoxGraphType.Items.Add(GraphTypes.TwoDIteration); this.comboBoxGraphType.SelectedIndex = 0; settings = new GraphSettings(); settings = _settings; mainForm = _mainForm; this.textBoxSlopeColorLimit.Text = settings.SlopeColorLimit.ToString(); this.textBoxBaseB.Text = settings.BaseB.ToString(); this.textBoxBaseG.Text = settings.BaseG.ToString(); this.textBoxBaseR.Text = settings.BaseR.ToString(); this.textBoxFunctionA.Text = settings.FunctionA.ToString(); this.textBoxFunctionB.Text = settings.FunctionB.ToString(); //Family constants this.textBoxC1Incr.Text = settings.C1Incr.ToString(); this.textBoxC1Max.Text = settings.C1Max.ToString(); this.textBoxC1Min.Text = settings.C1Min.ToString(); this.textBoxC2Incr.Text = settings.C2Incr.ToString(); this.textBoxC2Max.Text = settings.C2Max.ToString(); this.textBoxC2Min.Text = settings.C2Min.ToString(); //Funxction constants this.textBoxTraceLen.Text = settings.TraceLen.ToString(); this.textBoxxIncr.Text = settings.XIncr.ToString(); this.textBoxxMax.Text = settings.XMax.ToString(); this.textBoxxMin.Text = settings.XMin.ToString(); this.textBoxyIncr.Text = settings.YIncr.ToString(); this.textBoxyMax.Text = settings.YMax.ToString(); this.textBoxyMin.Text = settings.YMin.ToString(); this.textBoxStartingX.Text = settings.StartingX.ToString(); this.textBoxN.Text = settings.N.ToString(); this.pictureBoxBackground.BackColor = settings.Background; this.colorDialog1.Color = settings.Background; if (settings.GraphType.Equals(GraphTypes.Derivative)) { this.comboBoxGraphType.SelectedItem = GraphTypes.Derivative; } else if (settings.GraphType.Equals(GraphTypes.Function)) { this.comboBoxGraphType.SelectedItem = GraphTypes.Function; } else if (settings.GraphType.Equals(GraphTypes.VectorField)) { this.comboBoxGraphType.SelectedItem = GraphTypes.VectorField; } else if (settings.GraphType.Equals(GraphTypes.Slope)) { this.comboBoxGraphType.SelectedItem = GraphTypes.Slope; } else if (settings.GraphType.Equals(GraphTypes.ParametricFamily)) { this.comboBoxGraphType.SelectedItem = GraphTypes.ParametricFamily; } else if (settings.GraphType.Equals(GraphTypes.ParametricFunction)) { this.comboBoxGraphType.SelectedItem = GraphTypes.ParametricFunction; } else if (settings.GraphType.Equals(GraphTypes.Iteration)) { this.comboBoxGraphType.SelectedItem = GraphTypes.Iteration; } else if (settings.GraphType.Equals(GraphTypes.Cobweb)) { this.comboBoxGraphType.SelectedItem = GraphTypes.Cobweb; } else if (settings.GraphType.Equals(GraphTypes.TwoDIteration)) { this.comboBoxGraphType.SelectedItem = GraphTypes.TwoDIteration; } }
// This will be called whenever the list changes. private void SettingsChanged(object sender, EventArgs e) { grSettings = (GraphSettings)sender; CreateGraph(zedGraphControl1); SetSize(); zedGraphControl1.Refresh(); }
public void Detach() { // Detach the event and delete the list grSettings.Changed -= new ChangedEventHandler(SettingsChanged); grSettings = null; }