private void InitTrayLocation() { AppBarInfo info = new AppBarInfo(); info.GetSystemTaskBarPosition(); Rectangle workArea = info.WorkArea; int x = 0; int y = 0; if (info.Edge == AppBarInfo.ScreenEdge.Left) { x = workArea.Left + 2; y = (workArea.Bottom - base.Bounds.Height) - 5; } else if (info.Edge == AppBarInfo.ScreenEdge.Bottom) { x = (workArea.Right - this.m_oldBounds.Width) - 5; y = (workArea.Bottom - base.Bounds.Height) - 1; } else if (info.Edge == AppBarInfo.ScreenEdge.Top) { x = (workArea.Right - this.m_oldBounds.Width) - 5; y = (workArea.Top + this.m_oldBounds.Height) + 1; } else if (info.Edge == AppBarInfo.ScreenEdge.Right) { x = (workArea.Right - this.m_oldBounds.Width) - 5; y = (workArea.Bottom - base.Bounds.Height) - 1; } SetWindowPos(base.Handle, (IntPtr) (-1), x, y, 0, 0, 0x91); }
private void InitCenterLocation() { AppBarInfo info = new AppBarInfo(); Rectangle workArea = info.WorkArea; base.Location = new Point((workArea.Left + (workArea.Width / 2)) - (this.m_oldBounds.Width / 2), (workArea.Top + (workArea.Height / 2)) + (this.m_oldBounds.Height / 2)); }