VINET
VINET

Reputation: 661

Electron: How to resize the BrowserWindow?

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 });

Upvotes: 6

Views: 13172

Answers (2)

Coder Gautam YT
Coder Gautam YT

Reputation: 2147

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()

Upvotes: 0

devilpreet
devilpreet

Reputation: 767

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

Upvotes: 14

Related Questions