internal virtual bool IsOffscreen() { Rect itemRect = BoundingRectangle; if (itemRect.IsEmpty) { return(true); } // As per the specs, IsOffscreen only takes immediate parent-child relationship into account, // so we only need to check if this item in offscreen with respect to its immediate parent. ProxySimple parent = GetParent(); if (parent != null) { if ((bool)parent.GetElementProperty(AutomationElement.IsOffscreenProperty)) { return(true); } // Now check to see if this item in visible on its parent Rect parentRect = parent.BoundingRectangle; if (!parentRect.IsEmpty && !Misc.IsItemVisible(ref parentRect, ref itemRect)) { return(true); } } // if this element is not on any monitor than it is off the screen. NativeMethods.Win32Rect itemWin32Rect = new NativeMethods.Win32Rect(itemRect); return(UnsafeNativeMethods.MonitorFromRect(ref itemWin32Rect, UnsafeNativeMethods.MONITOR_DEFAULTTONULL) == IntPtr.Zero); }