0
votes

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,

1

1 Answers

3
votes

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