public MainForm() { InitializeComponent(); MaximizeBox = false; var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); var settings = configFile.AppSettings.Settings; if (settings == null) { settings.Add("set", "true"); configFile.Save(ConfigurationSaveMode.Modified); ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name); } if (settings["set"].Value == "true") { MessageBox.Show("Вариант №3. Лабораторная работа №3. " + Environment.NewLine + Environment.NewLine + "Знакомство с WinFroms. " + Environment.NewLine + "Построение графика овала Кассини и вывод таблицы значений функции. " + Environment.NewLine + Environment.NewLine + "Студент группы 495, Гнипель Анна Владимировна." + Environment.NewLine + "2021 год", "Информация о проекте", MessageBoxButtons.OK, MessageBoxIcon.Information); } chart1.ChartAreas[0].AxisX.Minimum = (double)LeftBorder.Value; chart1.ChartAreas[0].AxisX.Maximum = (double)RightBorder.Value; chart1.ChartAreas[0].AxisY.Minimum = (double)LowerBorder.Value; chart1.ChartAreas[0].AxisY.Maximum = (double)UpperBorder.Value; CalcFuncOvalCassini calcFunc = new CalcFuncOvalCassini(); calcFunc.Calc(-10, 10, -10, 10, 0, 0, 0, 1, 1, 0.01, chart1); }
private void PlotGraph_Click(object sender, EventArgs e) { double leftBorder = (double)LeftBorder.Value; double rightBorder = (double)RightBorder.Value; double upperBorder = (double)UpperBorder.Value; double lowerBorder = (double)LowerBorder.Value; double coefA = (double)CoefA.Value; double coefC = (double)CoefC.Value; double step = (double)Step.Value; double yPlus = 0, yMinus = 0, x = 0; bool value; chart1.Series[0].Points.Clear(); chart1.Series[1].Points.Clear(); chart1.Series[2].Points.Clear(); chart1.ChartAreas[0].AxisX.Minimum = leftBorder; chart1.ChartAreas[0].AxisX.Maximum = rightBorder; chart1.ChartAreas[0].AxisY.Minimum = lowerBorder; chart1.ChartAreas[0].AxisY.Maximum = upperBorder; CalcFuncOvalCassini calcFunc = new CalcFuncOvalCassini(); value = calcFunc.Calc(leftBorder, rightBorder, lowerBorder, upperBorder, x, yPlus, yMinus, coefA, coefC, step, chart1); try { System.IO.File.Delete(@"C:\Users\admin\Desktop\lab3\\chart.jpeg"); } catch { } this.chart1.SaveImage(@"C:\Users\admin\Desktop\lab3\\chart.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg); if (chart1.Series[0].Points == null || !value) { SaveTextToolStripMenuItem.Enabled = false; OpenTableToolStripMenuItem.Enabled = false; } else { SaveTextToolStripMenuItem.Enabled = true; OpenTableToolStripMenuItem.Enabled = true; } }