Under the window system -- electron custom borderless window menu & isMaximized() always returns false

insert image description here

Electron customizes a window with no borders and shadows (as shown above), and encountered two difficulties during the development process:

  1. How to add shadow to borderless
  2. How to implement a custom title bar (maximize, minimize, close, drag, double-click)
  3. Set transparent: true, isMaximized() always returns false

Record the solution below:

let win = new BrowserWindow({
            width:440,
            height:450,
            frame: false,
            transparent: true,
            webPreferences: {
                devTools:false,
                nodeIntegration: true,
                webviewTag: true
            }
        })
    <div class="content">
        <custom-header></custom-header>
        <div class="config-page">
     

Guess you like

Origin blog.csdn.net/cuiyuchen111/article/details/112393242