【发布时间】:2020-03-06 07:41:35
【问题描述】:
我从电子中删除了框架并添加了用于折叠、关闭和最大化/最小化的自定义按钮。
折叠和关闭效果很好,但最小化/最大化会闪烁并返回全屏
const [bounds, setBounds] = useState({width: 600, height: 600, x: 50, y: 50}) 是默认边界
useEffect(() => {
if (maximized) {
remote.BrowserWindow.getFocusedWindow().maximize()
} else {
//here is a problem
remote.BrowserWindow.getFocusedWindow().setBounds(bounds)
}
}, [bounds, bounds.height, bounds.width, maximized])
如何正确调整窗口大小?我也试过remote.BrowserWindow.getFocusedWindow().setSize()
【问题讨论】:
-
您的问题并不完全清楚。你想调整大小吗?或者你想最大化/取消最大化?你知道有像
remote.BrowserWindow.getFocusedWindow().unmaximize()这样的东西,对吧?如果窗口是全屏的,你可能应该先取消全屏。remote.BrowserWindow.getFocusedWindow().setFullScreen(false).