html - 如何在电子应用程序中制作圆角
问题描述
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);
}
角落总是有一个白色的边框间隙,使其成为矩形。
试图增加css的边框大小,但一切都扩大了。
解决方案
关键特性是:frame: false
和transparent: true
(你错过了后者)
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>
推荐阅读
- sql - 200万条记录的SqlDataAdapter.Update()速度极慢
- r - footers_replace_img_at_bkm 不在页脚/页眉中显示图像
- selenium - 如何找出 HTMLUnitDriver/Firefox 中出现问题的页面会自行关闭?
- angular - ng2-charts中折线图的渐变颜色
- ios - 无法选择或打印搜索栏过滤数组
- autohotkey - 如何在 Autohotkey 中重复发送密钥
- join - qgis 按位置连接属性 - 选项
- c# - 下面dll的数据访问层的代码覆盖率报告会为零吗?如果是,为什么?
- reactor-netty - 如何使用reactor-netty(没有Spring)接收分段文件上传?
- json - 来自 GET 方法的 JSON 数据