コード例 #1
0
        public void SetPanelPos(PanelPos panelPos)// Sets working area and checks if panels arent overlaying
        {
            switch (panelPos)
            {
            case PanelPos.Bottom:
                if (!MainWindow.Panels.Any(x => x.PanelPosition == PanelPos.Bottom))
                {
                    SpaceReserver.MakeNewDesktopArea(0, 0, 0, PanelHeight);
                    PanelPosition = PanelPos.Bottom;
                    this.Left     = 0;
                    this.Top      = System.Windows.SystemParameters.PrimaryScreenHeight - PanelHeight;
                }
                break;

            case PanelPos.Top:
                if (!MainWindow.Panels.Any(x => x.PanelPosition == PanelPos.Top))
                {
                    SpaceReserver.MakeNewDesktopArea(0, PanelHeight, 0, 0);
                    PanelPosition = PanelPos.Top;
                    this.Left     = 0;
                    this.Top      = 0;
                }
                break;

            case PanelPos.Left:
                if (!MainWindow.Panels.Any(x => x.PanelPosition == PanelPos.Left))
                {
                    int tmp = PanelHeight;
                    PanelHeight = PanelWidth;
                    PanelWidth  = tmp;
                    SpaceReserver.MakeNewDesktopArea(PanelHeight, 0, 0, 0);
                    PanelPosition = PanelPos.Left;
                    this.Left     = 0;
                    this.Top      = 0;
                }
                break;

            case PanelPos.Right:
                if (!MainWindow.Panels.Any(x => x.PanelPosition == PanelPos.Right))
                {
                    int tmp = PanelHeight;
                    PanelHeight = PanelWidth;
                    PanelWidth  = tmp;
                    SpaceReserver.MakeNewDesktopArea(0, 0, PanelHeight, 0);
                    PanelPosition = PanelPos.Right;
                    this.Left     = System.Windows.SystemParameters.PrimaryScreenWidth - PanelWidth;
                    this.Top      = 0;
                }
                break;
            }
            this.Width          = PanelWidth;
            this.Height         = PanelHeight;
            PanelElem.MaxWidth  = PanelWidth;
            PanelElem.MaxHeight = PanelHeight;
        }
コード例 #2
0
 public void SetPanelPos(PanelPos panelPos)// Sets working area and checks if panels arent overlaying
 {
     SpaceReserver.MakeNewDesktopArea(0, 32, 0, 0);
     Dispatcher.Invoke(
         () =>
     {
         PanelPosition = PanelPos.Top;
         this.Left     = 0;
         this.Top      = 0;
         this.Width    = PanelWidth;
         this.Height   = PanelHeight;
     });
     InteropHelper.SetWindowPos(Process.GetCurrentProcess().MainWindowHandle, InteropHelper.HWND_TOPMOST, 0, 0, 0, 0, InteropHelper.TOPMOST_FLAGS);
 }