public static Control FindControlAtPoint(Control container, Point pos)
{
foreach (Control c in container.Controls)
{
if (c.Visible && c.Bounds.Contains(pos))
{
var child = FindControlAtPoint(c, new Point(pos.X - c.Left, pos.Y - c.Top));
if (child == null)
{
return c;
}
return child;
}
}
return null;
}