简体   繁体   中英

How to make corners rounded in electron app

const electron = require("electron");
const {app, BrowserWindow, globalShortcut} = electron;
const path = require("path");

function createWindow(){
    win = new BrowserWindow({
        width: 1000, 
        height: 750, 
        icon: path.join(__dirname,'\checked.png'),
        frame: false,
        fullscreenable:false,
        // radii: [5,5,5,5],
        // transparent:true

    });

    win.loadFile('mainWindow.html')
    win.setMenu(null);
}

Always has a white border gap on corners, making it rectangular.

Have attempted to increase border size of css but everything expands.

Crucial properties for this are: frame: false and transparent: true (you missed the latter)

js

const {app, BrowserWindow} = require('electron')
const path = require('path')

app.once('ready', () => {
  let win = new BrowserWindow({
    frame: false,
    transparent: true
  })
  win.loadURL(path.join(__dirname, '/roundedcorner.html'))
})

html

<html>
  <body>
      <p style="border-radius: 25px; background: #73AD21; height: 300px;"></p>
  </body>
</html>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM