/// <summary> /// Gets the position of the system tray. /// </summary> /// <returns>Tray coordinates.</returns> public static Point GetTrayLocation() { var info = new AppBarInfo(); info.GetSystemTaskBarPosition(); Rectangle rcWorkArea = info.WorkArea; int x = 0, y = 0; if (info.Edge == AppBarInfo.ScreenEdge.Left) { x = rcWorkArea.Left + 2; y = rcWorkArea.Bottom; } else if (info.Edge == AppBarInfo.ScreenEdge.Bottom) { x = rcWorkArea.Right; y = rcWorkArea.Bottom; } else if (info.Edge == AppBarInfo.ScreenEdge.Top) { x = rcWorkArea.Right; y = rcWorkArea.Top; } else if (info.Edge == AppBarInfo.ScreenEdge.Right) { x = rcWorkArea.Right; y = rcWorkArea.Bottom; } return(new Point { X = x, Y = y }); }
/// <summary> /// Gets the position of the system tray. /// </summary> /// <returns>Tray coordinates.</returns> public static Point GetTrayLocation() { var info = new AppBarInfo(); info.GetSystemTaskBarPosition(); Rectangle rcWorkArea = info.WorkArea; int x = 0, y = 0; if (info.Edge == AppBarInfo.ScreenEdge.Left) { x = rcWorkArea.Left + 2; y = rcWorkArea.Bottom; } else if (info.Edge == AppBarInfo.ScreenEdge.Bottom) { x = rcWorkArea.Right; y = rcWorkArea.Bottom; } else if (info.Edge == AppBarInfo.ScreenEdge.Top) { x = rcWorkArea.Right; y = rcWorkArea.Top; } else if (info.Edge == AppBarInfo.ScreenEdge.Right) { x = rcWorkArea.Right; y = rcWorkArea.Bottom; } return new Point {X = x, Y = y}; }