I have a picture box appear, and I need to make it so if they click a part on the picture box (using x,y position of the box) it does something. Thanks in advance.
Printable View
I have a picture box appear, and I need to make it so if they click a part on the picture box (using x,y position of the box) it does something. Thanks in advance.
Use the MouseDown event of the picturebox, and then look at the e.location property to determine the x/y coordinate where the mouse was clicked, and take whatever action needs to be taken.
Not that kleinma is wrong, but you might want to consider using MouseClick rather than MouseDown. MouseDown is raised when and where the mouse button is depressed, whereas MouseClick is raised when and where the mouse button is released, and then only if the mouse button was depressed over the PictureBox too. Neither is right or wrong. It just depends which is more appropriate for your app.
Thanks. I tried both ways and it worked.