示例#1
0
 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();
     }
 }
示例#2
0
 private void HandleMouseUp(MouseEventArgs e, LinedPictureBox pb)
 {
     if (pbStartImage.Image != null && pbEndImage.Image != null)
     {
         if (_lineCreationInProcess)
         {
             // If we're creating a new line and if the line is too small, delete it.
             if (_lines.Selected != null)
             {
                 var line = _lines.Selected.Item(_currentLineImageNumber);
                 if (line.Item1.Equals(line.Item2))
                 {
                     _lines.Remove(_lines.Selected);
                 }
             }
         }
         _lineCreationInProcess = false;
         pbStartImage.Refresh();
         pbEndImage.Refresh();
     }
 }
示例#3
0
 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();
     }
 }
示例#4
0
 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();
     }
 }
示例#5
0
 private void HandleMouseUp(MouseEventArgs e, LinedPictureBox pb)
 {
     if (pbStartImage.Image != null && pbEndImage.Image != null)
     {
         if (_lineCreationInProcess)
         {
             // If we're creating a new line and if the line is too small, delete it.
             if (_lines.Selected != null)
             {
                 var line = _lines.Selected.Item(_currentLineImageNumber);
                 if (line.Item1.Equals(line.Item2))
                 {
                     _lines.Remove(_lines.Selected);
                 }
             }
         }
         _lineCreationInProcess = false;
         pbStartImage.Refresh();
         pbEndImage.Refresh();
     }
 }
示例#6
0
 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();
     }
 }