Per Jespersen

Per Jespersen

  • NA
  • 23
  • 35.2k

Position of a click on a picturebox

Aug 24 2012 5:53 AM

If I double click my picturebox in the design screen, I get a click event method in my code:

        private void PictureBox1_Click(object sender, EventArgs e)
        {
        }

I know very little of the event syntax and class design, so I don't know how to get information from the event in question. I would like to know the coordinates where my mouse clicked the picturebox. Something like this:

        private void PictureBox1_Click(object sender, EventArgs e)
        {
                int x = e.X;
                int y = e.Y;
        }

I know this won't work. But how should this be done?

Answers (1)