I'm having a bit of a problem with coordinates and mapping PictureBoxes. Here's the situation:
I've got a PictureBox holding an image of a football pitch. The aim is to record the shot positions on this pitch. So whenever the mouse is clicked on the pitch, I am recording the X and Y coordinates of the mouse at that time. This means that when I read from the database, it plots the shots accordingly.
The problem I am facing is when the form is moved from the top left corner of the screen.
I have the form set at 1024x768px - a fixed size. If the form is moved from the left corner of the screen, the shots are placed wrongly due to the coordinates changing.
I understand that the code that I am using is getting me the screen coordinates:
XPos = Control.MousePosition.X - 6
YPos = Control.MousePosition.Y - 27
What I am looking for is a way to get the coordinates relative to the form itself. This would mean that anytime I pull the coordinates from the database, they'll be correct no matter what the form's position is on the screen.
Any help would be appreciated.