I am getting complaints from users of an application I am working on that they have to click on the title bar or the border of the form to bring the form to the front when it is partially obscured by other forms. Other applications seem to accept clicks anywhere and provide this functionality.
I cannot find anything in the framework that handles this for WinForms, and modifying every form to add a handler for every control is not practical so I am considering a simple method to iterate the controls and attach a handler; something like this (untested and off the top of my head):
private void HookMouseEvents()
foreach (Control ctl in this.Controls)
ctl.MouseClick += new MouseEventHandler(HandleMouseClick);
void HandleMouseClick(object sender, MouseEventArgs e)
If this is a valid approach I am considering implementing it in a base form so that it percolates across the entire application.
Is there a better way to handle this requirement? Any other comments or suggestions?