I created a usercontrol, it consists of a picturebox with an image, add it to project, try to expose him to a click event, but it does not respond! What am I doing wrong? http://www.fileserve.com/file/yk9sjAu - usercontrol http://www.fileserve.com/file/4353g9z - my project
The click event only fires for clicks directly on your UserControl itself - not it's children.
To pass clicks from these as well, you need to chain the events:
public UserControl1()
{
InitializeComponent();
this.pictureBox1.Click += (s,e) => {base.OnClick(e);};
this.checkBox1.Click += (s,e) => {base.OnClick(e);};
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With