如何在电子浏览器中创建圆角窗口?

时间:2017-01-20 21:13:45

标签: javascript html css3 window electron

我到处搜索了如何让我的浏览器的角落四舍五入。

如何实现圆角?

我试过让它变得透明。但没有任何作用。

她的代码:



/**
 * we need to keep a global reference of the window object. If we don't, the
 * window will be closed automatically when the js object is garbage collected
 */
let win

function createWindow () {
  // Create the browser window.
  win = new BrowserWindow({
    width: 1800,
    height: 1000,
    frame: false,
    transparent: true,
    icon: __dirname + 'icon.png'
  })
  
  // and load the index.html of the app.
  win.loadURL(url.format({
    pathname: path.join(__dirname, 'index.html'),
    protocol: 'file:',
    slashes: true
  }))

  // Open the DevTools.
  win.webContents.openDevTools()

  // Emitted when the window is closed.
  win.on('closed', function () {
    /**
     * Dereference the window object, usually you would store windows in an
     * array if your app supports multi windows, this is the time when you
     * should delete the corresponding element.
     */
    win = null
  })
}




2 个答案:

答案 0 :(得分:0)

"January 23, 2017 1:28:37 PM"

"2017年1月23日 1:28:37午後"

答案 1 :(得分:0)

要获得透明度,请尝试使用opacity属性。范围是0到1