con fus ed

et_

Newcomer
Joined
Feb 16, 2007
Messages
15
I have a small app that adds pics to a picture box, but id like to make the images clickable. I know how to fire an event, add handlers, etc, but how do i add an event to an image ?

Im not sure if im even asking this question correctly.
I just want to know how i can tell when a newly added image (to a pic box) has been clicked.

Thanks
 
You mean when someone actually clicks the image?

If so just do like you do with a button. With your picture box on your form, double click it to add the clickable sub to your code.
 
No i mean if i have multiple images in a picture box, and a user clicks one, how do i know which one was clicked? Using only one picbox.
 
Last edited:
You would need to handle either the mouse up or mouse down events on the picture box and from there use the x and y co-ordinates to determine which image the mouse was over.
 
how would i get the coordinates? I could pull the position, but thats from the top left corner of the image, correct?
 
You would probably need to store the location and size of each image when you added it to the picturebox, and then check against these values when the user clicks against the picturebox.
 
Is there any way to display more than one image in a picturebox, i cant find code on how to do this anywhere.
 
Back
Top