If I understand you correctly, your GameButton user control fires an event when you click, but not when you click on a label - and you want both. This is due to the fact that the label (control) is on top of the background. Therefore, you need to register your shortcut with the click event. This can be done manually in the designer or programmatically for each control on the page.
If you want to do EVERY control in a UserControl, put it in the UserControl OnLoad event, and you can use the same click event for each control:
foreach(Control c in this.Controls){ c.Click += new EventHandler(yourEvent_handler_click); } public void yourEvent_handler_click (object sender, EventArgs e){
EDIT: The best way is to create a click event handler property in a user control. That way, every time you add / remove the click event for your user control, it automatically adds / removes it to all the controls in the user control.
public new event EventHandler Click { add { base.Click += value; foreach (Control control in Controls) { control.Click += value; } } remove { base.Click -= value; foreach (Control control in Controls) { control.Click -= value; } } }
This is from another post:
Hope this helps!
Imreg
source share