et_ Posted January 24, 2008 Posted January 24, 2008 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 Quote
techmanbd Posted January 24, 2008 Posted January 24, 2008 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. Quote Live as if you were to die tomorrow. Learn as if you were to live forever. Gandhi
et_ Posted January 25, 2008 Author Posted January 25, 2008 (edited) 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. Edited January 25, 2008 by et_ Quote
Administrators PlausiblyDamp Posted January 25, 2008 Administrators Posted January 25, 2008 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
et_ Posted January 26, 2008 Author Posted January 26, 2008 how would i get the coordinates? I could pull the position, but thats from the top left corner of the image, correct? Quote
Administrators PlausiblyDamp Posted January 26, 2008 Administrators Posted January 26, 2008 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
et_ Posted January 27, 2008 Author Posted January 27, 2008 Is there any way to display more than one image in a picturebox, i cant find code on how to do this anywhere. Quote
Leaders snarfblam Posted January 30, 2008 Leaders Posted January 30, 2008 I don't believe so. Quote [sIGPIC]e[/sIGPIC]
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.