private void PictureBox_Click(object sender, EventArgs e) { MouseEventArgs mouseEventArgs = (MouseEventArgs)e; var coordinates = mouseEventArgs.Location; if (coordinates.X < 0 || coordinates.X > _currentImageExample.Width || coordinates.Y < 0 || coordinates.Y > _currentImageExample.Height) { MessageBox.Show("You have tried to mark an area outside the image.\r\n" + "Try again.", "Invalid data!"); return; } if (_currentFrameState == ObjectFrameState.NotDefined) { UpdateCurrentBoundLuPoint(coordinates); _currentFrameState = ObjectFrameState.LuPointLocked; } else { if (coordinates.X <= _currentImageBound.Item2.X || coordinates.Y <= _currentImageBound.Item2.Y) { MessageBox.Show("Selected point do not make a valid rectangle.\r\n" + "Try again.", "Point invalid!"); return; } UpdateCurrentBoundRdPoint(coordinates); _currentFrameState = ObjectFrameState.Defined; } UpdateUI(); }
private void ResetCurrentBound() { _currentImageBound = new Tuple <ObjectClass, Point, Point>(ObjectClass.B1, Point.Empty, Point.Empty); _currentFrameState = ObjectFrameState.NotDefined; }