private void pictureBox_MouseMove(object sender, MouseEventArgs e) { if (controller.mode == DrawMode.MODE_DRAW_BY_MOUSE && controller.isDrawing == true) { int x = e.Location.X; int y = e.Location.Y; lbMousePos.Text = x.ToString() + ", " + y.ToString(); if (controller.mShape is Line) { Line l = (Line)controller.mShape; Point p = new Point(x, y); if (x != l.p1.x && y != l.p1.y) { l.p2 = p; drawingTemporary(); } } else if (controller.mShape is Circle) { Circle c = (Circle)controller.mShape; Point p = new Point(x, y); int r = (int)p.getDistance(c.I); if (r > 0) { c.R = r; drawingTemporary(); } } else if (controller.mShape is Ellipse) { Ellipse el = (Ellipse)controller.mShape; int ra = Math.Abs(el.I.x - x); int rb = Math.Abs(el.I.y - y); if (ra > 0 && rb > 0) { el.a = ra; el.b = rb; drawingTemporary(); } } else if (controller.mShape is Parabola) { Parabola pa = (Parabola)controller.mShape; pa.Bound = new Point(x, y); drawingTemporary(); } else if (controller.mShape is Hyperbole) { Hyperbole hy = (Hyperbole)controller.mShape; hy.Bound = new Point(x, y); drawingTemporary(); } } }
public void Calculate_GetValueForZero_Infinity() { var hyperbole = new Hyperbole(1); float result; result = hyperbole.Calculate(0); Assert.IsTrue(float.IsInfinity(result)); }
private void pictureBox_MouseDown(object sender, MouseEventArgs e) { if (controller.mode == DrawMode.MODE_DRAW_BY_MOUSE) { int x = e.Location.X; int y = e.Location.Y; lbMousePos.Text = x.ToString() + ", " + y.ToString(); controller.mColor = getRandomizeColor(); if (controller.mShape is Line) { Line l = (Line)controller.mShape; l.p1.x = x; l.p1.y = y; controller.isDrawing = true; } else if (controller.mShape is Circle) { Circle c = (Circle)controller.mShape; c.I.x = x; c.I.y = y; controller.isDrawing = true; } else if (controller.mShape is Ellipse) { Ellipse el = (Ellipse)controller.mShape; el.I.x = x; el.I.y = y; controller.isDrawing = true; } else if (controller.mShape is Parabola) { Parabola el = (Parabola)controller.mShape; el.I.x = x; el.I.y = y; controller.isDrawing = true; } else if (controller.mShape is Hyperbole) { Hyperbole hy = (Hyperbole)controller.mShape; hy.I.x = x; hy.I.y = y; try { int a = Int32.Parse(this.tbHyperA.Text); hy.a = a; controller.isDrawing = true; } catch { MessageBox.Show("Insert a number please."); controller.isDrawing = false; } } } }