Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void btn_Math_Click(object sender, EventArgs e)
- {
- try
- {
- float x = -5, x1 = 5;
- float k = float.Parse(textBox1.Text);
- float b = float.Parse(textBox2.Text);
- // нахождения корней уравнения
- float y = k * x + b;
- float y1 = k * x1 + b;
- // вывод корней уравненияx
- textBox3.Text = x.ToString() + "; " + x1.ToString() + "; ";
- textBox4.Text = y.ToString() + "; " + y1.ToString() + "; ";
- Pen pn = new Pen(Color.Red, 2);
- Graphics gr = pictureBox1.CreateGraphics();
- float w = pictureBox1.Size.Width / 2 - 5f;
- float h = pictureBox1.Size.Height / 2 - 6f;
- //gr.DrawLine(pn, w + x * 9.45f, h - y * 9.45f, w + x1 * 9.45f, h - y1 * 9.45f);
- }
- catch (FormatException ex)
- {
- MessageBox.Show("Проверте правильность введенных данных!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- textBox3.Clear();
- textBox2.Clear();
- textBox1.Clear();
- pictureBox1.Refresh();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement