private void toolStripButton5_Click(object sender, EventArgs e) { Functions.Clear(); RPN_Box.ResetText(); ChangeButton.Enabled = false; FunctionList.Items.Clear(); builder = new Builder(Draft, pixelcoeff * Convert.ToSingle(scale.Value)); builder.Clear(); builder.BuildNet(); builder.BuildAxes(); builder.BuildSection(); builder.BuildCoordinates(); }
private void button35_Click(object sender, EventArgs e) { firstFunctionBox.ResetText(); RPN_Box.ResetText(); }
private void toolStripButton6_Click(object sender, EventArgs e) { try { Function function = new Function(new StringBuilder(firstFunctionBox.Text), p.Color, p.DashStyle, 'x'); RPN_Box.ResetText(); foreach (string symbol in function.RPNsequence) { RPN_Box.Text += " " + symbol; } if (Functions.Contains(function) == true)//It works! { return; } else { Functions.Add(function); builder.DrawFunction(function); Image = Draft; } } catch (IndexOutOfRangeException) { MessageBox.Show("Error in syntax (1)", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } catch (NullReferenceException) { MessageBox.Show("Error in syntax (2). Perhaps you enter a wrong symbol", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } catch (ArithmeticException) { MessageBox.Show("Function cannot exist with double argument ", "ErrorInSyntaxException", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Exception", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } bool repetition = false; foreach (ListViewItem func in FunctionList.Items) { if (func.Text == firstFunctionBox.Text) { repetition = true; } } ColorFunction = new Bitmap(imageList1.ImageSize.Width, imageList1.ImageSize.Height); Graphics DrawColor = Graphics.FromImage(ColorFunction); SolidBrush color = new SolidBrush(p.Color); if (repetition != true) { DrawColor.FillRectangle(color, 0, 0, imageList1.ImageSize.Width, imageList1.ImageSize.Height); imageList1.Images.Add(ColorFunction); FunctionList.Items.Add(firstFunctionBox.Text, imageList1.Images.Count - 1); repetition = false; } }