Events
-
Hi guys, I have a control that has some picturebox controls on it. I'd like that the form on which my control is placed recieves an event notification when a picture box control recieves a MouseDown event. Simple enough but I'd like to use events. Right now I'm not sure what the code should look like. How and where do I add the parent form as a listener for an event happening within a control embedded within another control? Pseudo code will do. Regards Senkwe:omg: Just another wannabe code junky
-
Hi guys, I have a control that has some picturebox controls on it. I'd like that the form on which my control is placed recieves an event notification when a picture box control recieves a MouseDown event. Simple enough but I'd like to use events. Right now I'm not sure what the code should look like. How and where do I add the parent form as a listener for an event happening within a control embedded within another control? Pseudo code will do. Regards Senkwe:omg: Just another wannabe code junky
Add this code to the constructor...
this.pictureBox.MouseDown+= new System.Windows.Forms.MouseEventHandler(this.onMouseDown);
and the function which handles the mouse down...
private void onMouseDown (object sender, System.Windows.Forms.MouseEventArgs e)
{
//do whatever...
}This can be automated if you're using VS.NET... Andreas Philipson
-
Add this code to the constructor...
this.pictureBox.MouseDown+= new System.Windows.Forms.MouseEventHandler(this.onMouseDown);
and the function which handles the mouse down...
private void onMouseDown (object sender, System.Windows.Forms.MouseEventArgs e)
{
//do whatever...
}This can be automated if you're using VS.NET... Andreas Philipson