Skip to content

Commit

Permalink
Merge pull request #79 from bobindah/master
Browse files Browse the repository at this point in the history
Adding a basic Fullscreen mode (F11 to toggle)
  • Loading branch information
robinrodricks authored Jan 24, 2023
2 parents 61d3fa7 + 02e1d81 commit 3b5112c
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System.Reflection;
using SharpBrowser.Browser;
using SharpBrowser.Browser.Model;
using System.Windows.Forms.VisualStyles;

namespace SharpBrowser {

Expand Down Expand Up @@ -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);


}
Expand Down Expand Up @@ -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;

}
Expand Down Expand Up @@ -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) {

Expand Down

0 comments on commit 3b5112c

Please sign in to comment.