Picturebox
-
Hi! I want to execute some code when I click a picturebox, but I don't know how, and I can't find an answer anywhere. So could some kind person out there take some time to teach me? Thx Dan
Handle the click event of the picture box
I get all the news I need from the weather report - Paul Simon (from "The Only Living Boy in New York")
-
Hi! I want to execute some code when I click a picturebox, but I don't know how, and I can't find an answer anywhere. So could some kind person out there take some time to teach me? Thx Dan
DanSteeve wrote:
I want to execute some code when I click a picturebox, but I don't know how, and I can't find an answer anywhere. So could some kind person out there take some time to teach me?
You can just handle the Click event by creating an event handler that does whatever you want it to do. example:
myPictureBox.Click += new PictureBox.Click(myFunctionToDoSomething); private void myFunctionToDoSomething(object sender, EventArgs e) { // your stuff }
Seems like that would do the trick. I'm assuming the code you want to execute is part of your application, of course. You could fire off another process within the event handler, if you wanted. Hope that helps!It isn't enough to do well in life. One must do good when and where one can. Otherwise, what's the point?