Image Location -> Mouse Location
Hello, i would like to ask how can u make my picture be in same location as my mouse i tryed like this :
Image.Left = Cursor.Position.X;
Image.Top = Cursor.Position.Y;
But its not really correct cos corsor location isn't exactly there where we see it on our screen we can see it then we change forms location.
Marius HexesPosted Dec 16, 2007, 10:11 AM
AlanPosted Dec 16, 2007, 10:00 AM
Well, the Cursor.Position property gives the position in screen co-ordinates whereas the PictureBox's Left and Up properties represent client co-ordinates.
So, I think you need to convert the former to the latter. Something like this, if you're using the top left hand corner of the Picturebox as a reference point:
pictureBox1.Location = this.PointToClient(Cursor.Position);