javascript - Unable to disable fullscreen and block size of the windows in Electron JS
问题描述
I'm new to Electron Js and i've tried all the snippets that i could find, but i'm still unable to disable the possibilities to enlarge the window to a full screen size. I'm running the last version of Electron Js and Windows 10.
Here is the source code :
const { app, BrowserWindow } = require('electron')
try {
require('electron-reloader')(module)
} catch (_) {} //For dev purposes only
function createWindow () {
const win = new BrowserWindow({
width: 700,
height: 700,
webPreferences: {
frame:false,
maximizable: false,
fullscreen: false,
nodeIntegration: true
}
})
win.setMenuBarVisibility(false)
win.loadFile('src/index.html')
}
app.whenReady().then(createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
解决方案
它应该可以工作,(你能显示你的新 BrowserWindow 配置...)我通过修改配置在工作应用程序上进行了测试:
mainWindow = new BrowserWindow({
width: 850, //1200,
maxWidth:850,
minWidth:550, //1024,
height: 820,
webPreferences: webPref,
title: "MesRestau",
icon: __dirname + "/assets/images/favicon.ico"
});
推荐阅读
- r - 在 Shiny 中,如何创建图形分数图表?
- glsl - GLSL 接口块布局何时与 C/C++ 结构一致?
- wpf - 使用两个列表框自动调整简单表单的大小
- angular - 如何使用 ngx-translate 翻译角材料垫按钮中的文本标签
- jquery - 标题后的线条和图像,自动计算线条宽度以填满容器
- python - 如何在 Jupyter Notebook 中用希腊语 l 代替 lambda 关键字
- mongodb - 如何访问prisma创建的mongodb本地数据库
- java - 获取已打开文件通道的文件密钥
- python - 用于查找 1000 位数字的 13 位连续数字的最大乘积的代码未提供所需的输出
- hibernate - Spring JPA 存储库为更新子句生成错误的本机查询