mainWindow.loadURL('http://www.deathghost.cn') // 将本地文件打包 // mainWindow.loadFile('index.html') // 打开时最大化 // mainWindow.maximize(); // 浏览器F12控制台 // mainWindow.webContents.openDevTools() mainWindow.on('closed', function () { mainWindow = null; }) } app.on('...
这里接收 ipcMain.on('window-close', function () { app.quit() }) // 最小化 ipcMain.on('window-minimize', function () { win.minimize() }) // 全屏 ipcMain.on('window-maximize', function () { win.setFullScreen(true) }) // 退出全屏 ipcMain.on('window-unmaximize', function ()...
on('ready-to-show', () => { win.show() }) //生成调试工具栏 // win.webContents.openDevTools() // 窗口最大化 win.maximize() // 加载远程URL(网址) win.loadURL('https://www.iyouhun.com/') // 设置菜单栏 const template = [ { label: '文件', submenu: [ { label: '关于', ...
ipcRenderer.send('max-window') } 1. 2. 3. 主线程定义事件 ipcMain.on('max-window', () => { mainWindow.maximize() }) 1. 2. 3. 传参 let windowSize = 'unmax-window' function maxWindow() { windowSize = windowSize === 'max-window' ?'unmax-window':'max-window' ipcRenderer.s...
class WindowUtil{//窗口最小化static minWindow() { remote.getCurrentWindow().minimize(); }//窗口最大化static maxWindow(isMaxed) { const browserWindow=remote.getCurrentWindow();if(!isMaxed) { browserWindow.unmaximize(); }else{ browserWindow.maximize(); ...
9 mainWindow.maximize(); 10 }); 11 //unmaximize 12 ipcMain.on('orignal-window', () => { 13 mainWindow.unmaximize(); 14 }); 15 //打开默认浏览器 16 ipcMain.on('open-office-website', function(event, arg){ 17 shell.openExternal(arg) ...
I had set the max-width and max-height of the window when creating a new object using BrowserWindow. When I click on Maximize button, it grows to it maximum size, after that minimize the window. Now use Alt+Tab to bring window into focus, the size of the window should be same. ...
ipcMain.on("max-icon",() =>{//点击最大化时,主进程响应mainWindow.isMaximized() ? mainWindow.restore() : mainWindow.maximize(); }); ipcMain.on("mini-icon",() =>{//点击最小化时mainWindow.minimize();//界面最小化mainWindow.hide();//隐藏界面if(!appTray) { ...
大最小化、以为系统默认支持,这个只是针对windows平台ipc.on('window-min',function(){mainWindow.minimize();})//登录窗口最大化 ipc.on('window-max',function(){if(mainWindow.isMaximized()){mainWindow.restore();}else{mainWindow.maximize();}})ipc.on('window-close',function(){mainWindow.close()...
close window off your computer screen (i have 3 screen on my computer), on your screen the electron window reappears :( for reproduce : use this code inside main.js (electron quick start) const electron = require('electron') const {app, BrowserWindow} = require('electron'); let win; ...