private void MyFunctionPicture_MouseUp(object sender, MouseEventArgs e) { chartPoint = new Point(-1, -1); MyFunctionPicture.Invalidate(); Cursor = Cursors.Default; InitializeMyFunction(); }
private void MyFunctionPicture_MouseMove(object sender, MouseEventArgs e) { if (chartPoint == new Point(-1, -1)) { return; } int newY = e.Y; if (newY < cartesianStart.Y - 255) { newY = cartesianStart.Y - 255; } if (newY > cartesianStart.Y) { newY = cartesianStart.Y; } for (int i = 0; i < myPoints.Count; i++) { if (myPoints[i] == chartPoint) { Point newPoint = new Point(myPoints[i].X, newY); myPoints[i] = newPoint; chartPoint = newPoint; MyFunctionPicture.Invalidate(); return; } } }
private void MyFunctionPicture_MouseDown(object sender, MouseEventArgs e) { chartPoint = GetPoint(new Point(e.X, e.Y)); if (chartPoint != new Point(-1, -1)) { MyFunctionPicture.Invalidate(); Cursor = Cursors.SizeNS; } }