public static Control GetFocusControl() { Control focusControl = null; IntPtr focusHandle = User32Interop.GetFocus(); if (focusHandle != IntPtr.Zero) { focusControl = Control.FromHandle(focusHandle); } return(focusControl); }