ACAT.Lib.Core.Utility.Windows.FindControlAtPoint C# (CSharp) Метод

FindControlAtPoint() публичный статический Метод

Finds which control of a window is at the specified point
public static FindControlAtPoint ( Control container, Point pos ) : Control
container System.Windows.Forms.Control the container window
pos Point point to examine
Результат System.Windows.Forms.Control
        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;
        }