diff --git a/src/MainForm.cs b/src/MainForm.cs index 9d1aa76..7238fc1 100644 --- a/src/MainForm.cs +++ b/src/MainForm.cs @@ -15,6 +15,7 @@ using System.Reflection; using SharpBrowser.Browser; using SharpBrowser.Browser.Model; +using System.Windows.Forms.VisualStyles; namespace SharpBrowser { @@ -94,6 +95,7 @@ private void InitHotkeys() { KeyboardHandler.AddHotKey(this, OpenSearch, Keys.F, true); KeyboardHandler.AddHotKey(this, CloseSearch, Keys.Escape); KeyboardHandler.AddHotKey(this, StopActiveTab, Keys.Escape); + KeyboardHandler.AddHotKey(this, ToggleFullscreen, Keys.F11); } @@ -193,7 +195,7 @@ private void ConfigureBrowser(ChromiumWebBrowser browser) { //config.WebSecurity = WebSecurity.ToCefState(); config.WebGl = BrowserConfig.WebGL.ToCefState(); //config.ApplicationCache = ApplicationCache.ToCefState(); - + browser.BrowserSettings = config; } @@ -421,6 +423,28 @@ public void CloseActiveTab() { } } } + private FormWindowState oldWindowState; + private FormBorderStyle oldBorderStyle; + private bool isFullScreen = false; + + private void ToggleFullscreen() + { + + if (!isFullScreen) + { + oldWindowState = this.WindowState; + oldBorderStyle = this.FormBorderStyle; + this.FormBorderStyle = FormBorderStyle.None; + this.WindowState = FormWindowState.Maximized; + isFullScreen = true; + } + else + { + this.FormBorderStyle = oldBorderStyle; + this.WindowState = oldWindowState; + isFullScreen = false; + } + } private void OnTabClosed(object sender, EventArgs e) {