mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-04 05:34:51 +00:00
Change window size #144
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @GuiFerrari on GitHub (Apr 13, 2018).
Originally assigned to: @GregorBiswanger on GitHub.
I searched the forums, but I only found it for ElectronJS. I need to change the size of the window and leave it with a fixed size using Electron.NET
@GregorBiswanger commented on GitHub (Apr 14, 2018):
Hi @GuiFerrari,
do you can set the window size with two ways:
1. On create a new window with BrowserWindowOptions
var browserWindowOptions = new BrowserWindowOptions { Width = 800, Height = 600 }; await Electron.WindowManager.CreateWindowAsync(browserWindowOptions);2. On runtime with the instance of the BrowserWindow
var browserWindow = Electron.WindowManager.BrowserWindows.First(); browserWindow.SetSize(800, 600);I hope my answer helps you.
@krishrana17 commented on GitHub (Jan 4, 2023):
Is there any way to get the screen width and height in Electron.Net ?
I don't want to specify any static value like this -
var browserWindowOptions = new BrowserWindowOptions { Width = 800, Height = 600 }; await Electron.WindowManager.CreateWindowAsync(browserWindowOptions);