How do I get access the sender control (ie: changing is location etc)? I have created some picture boxes at the runtime in a panel set its click event to a function. I want
In your click handler, cast the 'sender' parameter to a PictureBox and examine its Location.
void pb_point_Click(object sender, EventArgs e)
{
var pictureBox = (PictureBox)sender;
MessageBox.Show(pictureBox.Location.ToString());
}
Sender
is your picturebox. Just cast it:
void pb_point_Click(object sender, EventArgs e)
{
var pictureBox = (PictureBox)sender;
MessageBox.Show(pictureBox.Location.ToString()); //Retrun location of another control.
}