Panel/UserControl behavior

I have a UserControl in a .dll and my application is putting it on a form.  The only controls on it are labels and a PictureBox.  I would like to add a Click event for the UserControl but when I do it only works for clicking on the open spaces in the UserControl, it doesn't work when you click on the label.  Is there a way that I could flatten everything down so the click event will work for the whole UserControl


Answer this question

Panel/UserControl behavior

  • jonalder

    You will have to add an event inside your usercontrol to every component that allows clicking with code like this:

    private void pictureBox1_Click(object sender, EventArgs e)

    {

    OnClick(e);

    }


     


  • Panel/UserControl behavior