private void HandleMouseMove(MouseEventArgs e, LinedPictureBox pb) { if (pbStartImage.Image != null && pbEndImage.Image != null) { if (_lines.Selected != null && (e.Button == MouseButtons.Left || e.Button == MouseButtons.Right)) { _lines.Selected.Item(_currentLineImageNumber)[_currentLineEnd] = pb.TranslateImageToControl((PointF)e.Location); if (_lineCreationInProcess) { // if we're creating the line, shape both the start and end line the same _lines.Selected.Item(_currentLineImageNumber ^ 1)[_currentLineEnd] = _lines.Selected.Item(_currentLineImageNumber)[_currentLineEnd]; } } pbStartImage.Refresh(); pbEndImage.Refresh(); } }
private void HandleMouseDown(MouseEventArgs e, LinedPictureBox pb) { if (pbStartImage.Image != null && pbEndImage.Image != null) { PointF point = pb.TranslateImageToControl((PointF)e.Location); if (e.Button == MouseButtons.Left) { SetFoundPairAtPoint(pb.ImageNumber, point); } else { _lines.Add(Tuple.Create( new Line(point, point), new Line(point, point))); _currentLineImageNumber = pb.ImageNumber; _currentLineEnd = 1; _lineCreationInProcess = true; } pbStartImage.Refresh(); pbEndImage.Refresh(); } }