ComponentFactory.Krypton.Navigator.VisualPopupPage.GetControlWithFocus C# (CSharp) Method

GetControlWithFocus() private method

private GetControlWithFocus ( Control control ) : Control
control System.Windows.Forms.Control
return System.Windows.Forms.Control
        private Control GetControlWithFocus(Control control)
        {
            // Does the provided control have the focus?
            if (control.Focused)
                return control;
            else
            {
                // Check each child hierarchy in turn
                foreach (Control child in control.Controls)
                    if (child.ContainsFocus)
                        return GetControlWithFocus(child);

                return null;
            }
        }