我希望我的主窗口100%的屏幕不是全屏,也不能调整大小。
const electron = require('electron');
const url = require('url');
const path = require('path');
const{app, BrowserWindow} = electron;
let mainWindow;
app.on('ready', function(){
mainWindow = new BrowserWindow({resizable:false,height:800,width:1535});
mainWindow.loadURL(url.format({
pathname: path.join(__dirname,"index.html"),
protocol: 'file',
slashes:true
}));
mainWindow.on('closed',function(){
app.quit();
});
});
答案 0 :(得分:1)
正如我在评论中提到的,您的显示器workAreaSize
应该等于最大化窗口大小
const electron = require('electron')
const {app, BrowserWindow} = electron
app.on('ready', () => {
const display = electron.screen.getPrimaryDisplay()
const maxiSize = display.workAreaSize
new BrowserWindow({
resizable: false,
height: maxiSize.height,
width: maxiSize.width
})
})