0

This is my first question ever on Stackoverflow. So I hope it for the best answer.

I want to get correct X and Y coordinate of an Image with mouse over Event (WFA .NET Framework). Take a look at my cursor

The coordinate should be somewhere between 500 for X and 427 for Y, but I only get as I posted. I already maxed out the scroll. And I think the image resolution is correct, here's the image properties

Here's my code:

private void pbInput_MouseMove(object sender, MouseEventArgs e) {        
mouseX.Text = e.X.ToString();
mouseY.Text = e.Y.ToString();
}

And I have a plan to zooming the image for the future, so I put "auto scroll" panel below the picture box.

Could you help me? Thank you so much.

PS: Sorry for my bad English

Nggarap
  • 63
  • 8

1 Answers1

0

Try putting picturebox inside panel set panel to:

this.panel1.AutoScroll = true;

and picturebox to

this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;

this will allow panel to have scroll bars and picturebox will have its full size adjusted to actual picture size

  • Thank you. Apparently is working, but if I working on zoomed image, the coordinates still incorrect. [I'm using this solution](https://stackoverflow.com/a/22164138/8903813) for zooming – Nggarap Apr 17 '20 at 01:22