private void MoveToFullscreenMode(FullscreenMode mode)
        {
            var screens = Screen.AllScreens;

            var   currentScreen = Screen.FromControl(_mainForm);
            Size  size          = _mainForm.Size;
            Point location      = _mainForm.Location;

            switch (mode)
            {
            case FullscreenMode.Standard:
            default:
                size     = currentScreen.WorkingArea.Size;
                location = currentScreen.WorkingArea.Location;
                break;

            case FullscreenMode.Fullscreen:
                size     = currentScreen.Bounds.Size;
                location = currentScreen.Bounds.Location;
                break;

            case FullscreenMode.AllScreens:
                size     = SystemInformation.VirtualScreen.Size;
                location = SystemInformation.VirtualScreen.Location;
                break;
            }

            _mainForm.Size     = size;
            _mainForm.Location = location;
        }
        public void SwitchFullscreen(FullscreenMode mode)
        {
            if (IsFullscreen)
            {
                MoveToFullscreenMode(mode);
                return;
            }

            if (!_mainForm.ThumbnailPanel.IsShowingThumbnail)
            {
                return;
            }

            //On switch, always hide side panels
            _mainForm.CloseSidePanel();

            //Store state
            _preFullscreenLocation    = _mainForm.Location;
            _preFullscreenSize        = _mainForm.ClientSize;
            _preFullscreenBorderStyle = _mainForm.FormBorderStyle;

            //Change state to fullscreen
            _mainForm.FormBorderStyle = FormBorderStyle.None;
            MoveToFullscreenMode(mode);

            CommonCompleteSwitch(true);
        }
        /// <summary>
        /// Gets the fullscreen mode as an enumeration value.
        /// </summary>
        public static FullscreenMode GetFullscreenMode(this Settings settings)
        {
            FullscreenMode retMode = FullscreenMode.Standard;

            Enum.TryParse <FullscreenMode>(settings.FullscreenMode, out retMode);

            return(retMode);
        }
        /// <summary>
        /// Creates a new <see cref="Screensaver"/> with the given fullscreen mode.
        /// </summary>
        /// <param name="fullscreenMode">A value indicating the fullscreen windowing mode.</param>
        protected Screensaver(FullscreenMode fullscreenMode)
        {
            this.fullscreenMode = fullscreenMode;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Framerate = 30;

            framerateTimer.Elapsed += new System.Timers.ElapsedEventHandler(framerateTimer_Elapsed);
            framerateTimer.Start();
        }
Exemple #5
0
        public string ConfigDump()
        {
            StringBuilder configBuilder = new StringBuilder();

            configBuilder.AppendLine(String.Empty);
            configBuilder.AppendLine("Configuration Dump");
            configBuilder.AppendLine("WaitTimeToKillOrigin = " + WaitTimeToKillOrigin.ToString());
            configBuilder.AppendLine("FullscreenMode = " + FullscreenMode.ToString());
            configBuilder.AppendLine("WindowHeight = " + WindowHeight.ToString());
            configBuilder.AppendLine("WindowWidth = " + WindowWidth.ToString());
            configBuilder.AppendLine("ManageOrigin = " + ManageOrigin.ToString());
            configBuilder.AppendLine("DisableHardwareAccel = " + DisableHardwareAccel.ToString());
            return(configBuilder.ToString());
        }
Exemple #6
0
 private void ToggleFullscreen(FullscreenMode mode = FullscreenMode.Nothing)
 {
     if ((mode != FullscreenMode.PreventFullscreen &&
          FormBorderStyle == FormBorderStyle.Sizable &&
          WindowState == FormWindowState.Normal &&
          !TopMost) ||// && OptionsBTN.Visible)
         (mode == FullscreenMode.ForceFullscreen))
     {
         FormBorderStyle = FormBorderStyle.None;
         WindowState     = FormWindowState.Maximized;
         TopMost         = true;
     }
     else
     {
         FormBorderStyle = FormBorderStyle.Sizable;
         WindowState     = FormWindowState.Normal;
         TopMost         = false;
     }
 }
        public void SwitchFullscreen(FullscreenMode mode)
        {
            if (IsFullscreen) {
                MoveToFullscreenMode(mode);
                return;
            }

            if (!_mainForm.ThumbnailPanel.IsShowingThumbnail)
                return;

            //On switch, always hide side panels
            _mainForm.CloseSidePanel();

            //Store state
            _preFullscreenLocation = _mainForm.Location;
            _preFullscreenSize = _mainForm.ClientSize;
            _preFullscreenBorderStyle = _mainForm.FormBorderStyle;

            //Change state to fullscreen
            _mainForm.FormBorderStyle = FormBorderStyle.None;
            MoveToFullscreenMode(mode);

            CommonCompleteSwitch(true);
        }
Exemple #8
0
 public static extern void SetFullscreenMode(FullscreenMode mode);
Exemple #9
0
 /// <summary>
 /// Sets the fullscreen mode.
 /// </summary>
 public static void SetFullscreenMode(this Settings settings, FullscreenMode mode)
 {
     settings.FullscreenMode = mode.ToString();
 }
        /// <summary>
        /// Creates a new <see cref="Screensaver"/> with the given fullscreen mode.
        /// </summary>
        /// <param name="fullscreenMode">A value indicating the fullscreen windowing mode.</param>
        protected Screensaver(FullscreenMode fullscreenMode)
        {
            this.fullscreenMode = fullscreenMode;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Framerate = 30;

            framerateTimer.Elapsed += new System.Timers.ElapsedEventHandler(framerateTimer_Elapsed);
            framerateTimer.Start();
        }
Exemple #11
0
 public static extern int SetWindowFullscreen(Window window, FullscreenMode mode);
        private void MoveToFullscreenMode(FullscreenMode mode)
        {
            var screens = Screen.AllScreens;

            var currentScreen = Screen.FromControl(_mainForm);
            Size size = _mainForm.Size;
            Point location = _mainForm.Location;

            switch (mode) {
                case FullscreenMode.Standard:
                default:
                    size = currentScreen.WorkingArea.Size;
                    location = currentScreen.WorkingArea.Location;
                    break;

                case FullscreenMode.Fullscreen:
                    size = currentScreen.Bounds.Size;
                    location = currentScreen.Bounds.Location;
                    break;

                case FullscreenMode.AllScreens:
                    size = SystemInformation.VirtualScreen.Size;
                    location = SystemInformation.VirtualScreen.Location;
                    break;
            }

            _mainForm.Size = size;
            _mainForm.Location = location;
        }
 /// <summary>
 /// Sets the fullscreen mode.
 /// </summary>
 public static void SetFullscreenMode(this Settings settings, FullscreenMode mode)
 {
     settings.FullscreenMode = mode.ToString();
 }
Exemple #14
0
        public void EnableFullscreen(FullscreenMode mode = FullscreenMode.LargestScale)
        {
            Graphics.IsFullScreen = true;
            Graphics.PreferredBackBufferWidth = GraphicsDevice.DisplayMode.Width;
            Graphics.PreferredBackBufferHeight = GraphicsDevice.DisplayMode.Height;
            Graphics.ApplyChanges();

            if (mode == FullscreenMode.LargestScale)
                Scale = Math.Min(GraphicsDevice.DisplayMode.Width / (float)screenRect.Width, GraphicsDevice.DisplayMode.Height / (float)screenRect.Height);
            else if (mode == FullscreenMode.LargestIntegerScale)
                Scale = (float)Math.Floor(Math.Min(GraphicsDevice.DisplayMode.Width / (float)screenRect.Width, GraphicsDevice.DisplayMode.Height / (float)screenRect.Height));

            HandleFullscreenViewport();
        }