SampleApp.MainForm.pictureBox_MouseClick C# (CSharp) Method

pictureBox_MouseClick() private method

private pictureBox_MouseClick ( object sender, MouseEventArgs e ) : void
sender object
e MouseEventArgs
return void
        private void pictureBox_MouseClick(object sender, MouseEventArgs e)
        {
            if (pointIndexToLocate != -1)
            {
                pictureBox.Cursor = Cursors.Default;
                pictureBox.Capture = false;
                statusLabel.Text = string.Empty;

                if (e.Button == MouseButtons.Left)
                {
                    int x = Math.Max(0, Math.Min(e.X, imageSize.Width - 1));
                    int y = Math.Max(0, Math.Min(e.Y, imageSize.Height - 1));

                    imagePoints[pointIndexToLocate] = new Accord.Point(x - imageSize.Width / 2, imageSize.Height / 2 - y);

                    TextBox imagePointTextBox = (TextBox)imagePointsGroupBox.Controls[string.Format("imagePoint{0}Box", pointIndexToLocate + 1)];
                    imagePointTextBox.Text = imagePoints[pointIndexToLocate].ToString();
                }
                else
                {
                    imagePoints[pointIndexToLocate] = pointPreviousValue;
                }

                ClearEstimation();

                pointIndexToLocate = -1;
                pictureBox.Invalidate();
            }
        }
MainForm