This is my son?
2 answers
Sounds like a great chance to use recursion. Add this function to your parent class:
private bool IsChild(System.Windows.Forms.Control control, System.IntPtr hWnd)
{
if(control.Handle == hWnd)
return(true);
foreach (System.Windows.Forms.Control child in control.Controls)
{
if (IsChild(child, hWnd))
return (true);
}
return (false);
}
Then you can use this function to find this parent class for any child controls with the specified hWnd:
this.IsChild(this, hWnd);
+2
a source to share