private static bool IsCursorAndWindowSameScreen(IntPtr win) { Native.POINT pt; Native.GetCursorPos(out pt); var fgWinScreen = Screen.FromHandle(win); var cursorScreen = Screen.FromPoint(pt.ToPoint()); return(fgWinScreen.Equals(cursorScreen)); }
/// <include file='doc\Screen.uex' path='docs/doc[@for="Screen.GetBounds"]/*' /> /// <devdoc> /// <para> /// Retrieves the bounds of the monitor that is closest to the specified /// point. /// </para> /// </devdoc> public static Rectangle GetBounds(Point pt) { return(Screen.FromPoint(pt).Bounds); }
/// <include file='doc\Screen.uex' path='docs/doc[@for="Screen.GetWorkingArea"]/*' /> /// <devdoc> /// <para> /// Retrieves the working area for the monitor that is closest to the /// specified point. /// /// </para> /// </devdoc> public static Rectangle GetWorkingArea(Point pt) { return(Screen.FromPoint(pt).WorkingArea); }