0

I want to see my pixel coordinates on moviing my mouse on the image in picture box

I have added this event Form.designer.cs

this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);

and this method in Form.cs

private void pictureBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{          
    locationtxt.Text = e.X.ToString() + "," + e.Y.ToString();
}

but I cann't see anything in textbox on moving my mouse on form runtime.

What should i add further. regards,

decyclone
  • 30,394
  • 6
  • 63
  • 80
Shahgee
  • 3,303
  • 8
  • 49
  • 81

1 Answers1

3

You need to attach to the picturebox's event, not this, and to the MouseMove event, not MouseDown.

fejesjoco
  • 11,763
  • 3
  • 35
  • 65