Exemplo n.º 1
0
        public void ResetPosition()
        {
            double top           = System.Windows.Forms.SystemInformation.WorkingArea.Top / DpiHelper.DpiScale;
            double taskbarHeight = 0;

            if (Settings.Instance.TaskbarMode == 1)
            {
                // special case, since work area is not reduced with this setting
                // this keeps the desktop going beneath the TaskBar

                // get the TaskBar's height
                double             dpiScale     = 1;
                AppBarScreen       screen       = AppBarScreen.FromPrimaryScreen();
                NativeMethods.Rect workAreaRect = _appBarManager.GetWorkArea(ref dpiScale, screen, false, false);
                taskbarHeight = (screen.Bounds.Bottom - workAreaRect.Bottom) / dpiScale;

                // top TaskBar means we should push down
                if (Settings.Instance.TaskbarPosition == 1)
                {
                    top = workAreaRect.Top / dpiScale;
                }
            }

            Width  = WindowManager.PrimaryMonitorWorkArea.Width / DpiHelper.DpiScale;
            Height = (WindowManager.PrimaryMonitorWorkArea.Height / DpiHelper.DpiScale) - taskbarHeight;

            grid.Width  = Width;
            grid.Height = Height;

            Top  = top;
            Left = System.Windows.Forms.SystemInformation.WorkingArea.Left / DpiHelper.DpiScale;
        }
Exemplo n.º 2
0
        private void setGridPosition()
        {
            double top  = SystemInformation.WorkingArea.Top / DpiHelper.DpiScale;
            double left = SystemInformation.WorkingArea.Left / DpiHelper.DpiScale;

            if (_desktopManager.ShellWindow != null || _desktopManager.AllowProgmanChild)
            {
                top  = (0 - SystemInformation.VirtualScreen.Top + SystemInformation.WorkingArea.Top) / DpiHelper.DpiScale;
                left = (0 - SystemInformation.VirtualScreen.Left + SystemInformation.WorkingArea.Left) / DpiHelper.DpiScale;
            }

            grid.Width = WindowManager.PrimaryMonitorWorkArea.Width / DpiHelper.DpiScale;

            if (Settings.Instance.TaskbarMode == 1)
            {
                // special case, since work area is not reduced with this setting
                // this keeps the desktop going beneath the TaskBar
                // get the TaskBar's height
                double             dpiScale     = 1;
                NativeMethods.Rect workAreaRect = _appBarManager.GetWorkArea(ref dpiScale, Screen.PrimaryScreen, false, false);

                grid.Height = (WindowManager.PrimaryMonitorWorkArea.Height / DpiHelper.DpiScale) - ((Screen.PrimaryScreen.Bounds.Bottom - workAreaRect.Bottom) / dpiScale);

                if (Settings.Instance.TaskbarPosition == 1)
                {
                    top += (workAreaRect.Top - SystemInformation.WorkingArea.Top) / dpiScale;
                }
            }
            else
            {
                grid.Height = WindowManager.PrimaryMonitorWorkArea.Height / DpiHelper.DpiScale;
            }

            grid.Margin = new Thickness(left, top, 0, 0);
        }