GetTaskbarRectangle() public static method

Gets the rectangle of the taskbar.
public static GetTaskbarRectangle ( ) : Rectangle
return System.Drawing.Rectangle
示例#1
0
        /// <summary>
        /// Determines whether the specified System.Drawing.Rectangle is contained within the Windows 7 notification area fly-out.
        /// Note that this function will return false if the fly-out is closed, or if run on older versions of Windows.
        /// </summary>
        /// <param name="point">System.Drawing.Rectangle to test.</param>
        /// <returns>True if the notify icon is in the fly-out, false if not.</returns>
        public static bool IsRectangleInFlyOut(Rectangle rectangle)
        {
            if (!SysInfo.IsWindows7OrLater)
            {
                return(false);
            }

            Rectangle taskbarRect = Taskbar.GetTaskbarRectangle();

            // Don't use Rectangle.IntersectsWith since we want to check if it's ENTIRELY inside
            return(rectangle.Left > taskbarRect.Right || rectangle.Right < taskbarRect.Left ||
                   rectangle.Bottom < taskbarRect.Top || rectangle.Top > taskbarRect.Bottom);
        }
示例#2
0
 private static bool MouseInTaskbar()
 {
     return(Taskbar.GetTaskbarRectangle().Contains(Cursor.Position));
 }