User control click event not working when clicking on text inside control?

前端 未结 3 719
逝去的感伤
逝去的感伤 2020-12-19 07:23

I have a user control called GameButton that has a label inside it. When I add the user control to my form, and add a click event to it, its triggered when you

3条回答
  •  太阳男子
    2020-12-19 07:57

    You can create a new method and assign all the controls to it

    private void Control_Click(object sender, EventArgs e)
    {
       this.OnClick(e);
    }
    

    This will raise main control(or usercontrol) event.

提交回复
热议问题