What I want to do: I have a PictureBox with an image loaded in it. The user is supposed to click somewhere on the picture. After clicking, I save the coordinates where he clicked.
Then I want to create a new box as shown in the picture (NOTE: If the user clicks at the edges, it shouldn't overlap the image:
After that, I want to save all the coordinates [starting/ending] so when the user clicks again in the next form I can validate whether the click was within the box created before.
What I got so far:
private void pictureBox1_Click(object sender, EventArgs e)
{
var centerX = ((MouseEventArgs) e).X;
var centerY = ((MouseEventArgs) e).Y;
// create box with center in these coordinates
// save all the coordinates of the box, so I can check if further clicks are within the created box
}
My problem is Creating the box after a click knowing the center location of it. Kinda confused how it's supposed to be created.