Electron: How to resize the BrowserWindow?
Asked Answered
G

2

6

How to change the size of the BrowserWindow, not at startup, but on time work?

All the solutions that I found were about such:

var win = new BrowserWindow({ width: 800, height: 600, show: false });
Galilean answered 1/7, 2017 at 1:16 Comment(0)
U
14

Do you mean after the BrowserWindow is created you want to change its size dynamically. You can use setSize

win.setSize(width, height[, animate])

Refer docs

Unemployed answered 1/7, 2017 at 6:1 Comment(0)
U
0

Use the setSize method, you should also use .center afterwards to prevent any unnecessary movement after the change

// width, height, animate (true or false)
win.setSize(300, 200, faldse)
win.center()
Undertake answered 21/10, 2023 at 2:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.