2017-01-20 57 views
1

我到處搜索如何使瀏覽器窗口的圓角變圓。如何在電子browserWindow中創建圓角?

如何實現圓角?

我試過讓它透明。但沒有任何工作。

赫斯我的代碼:

/** 
 
* 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 
 
    }) 
 
}

+0

'框架:假的,半徑:[5,5,5,5]'是我看過。 – scoopzilla

+0

添加了哪裏? @scoopzilla – WorldWideBangers

+0

@scoopzilla它不起作用 – WorldWideBangers

回答

0
function createWindow() { 
    // Create the browser window. 
    win = new BrowserWindow({ 
     width: 1800, 
     height: 1000, 
     frame: false, 
     radii: [5,5,5,5], 
     transparent: true, 
     icon: __dirname + 'icon.png' 
}) 
+0

這不起作用。正如我試圖讓角落變圓。它仍然不圓。 – WorldWideBangers

+0

我必須缺少一些東西。對不起:( – scoopzilla