左边两个是devexpress的控件checkedit但只能设置forecolor然后字体变黄,右边两个是自带的checkbox,style选flat变成checkbox1,但是达不到想要的效果,想要效果如下图
求教
你的是WPF吧?可以参考一下:https://www.cnblogs.com/xiaomingg/p/8727700.html,如有帮助,望采纳,谢谢
尝试了一下
代码:
<html>
<head>
<meta charset="UTF-8">
<title>美化checkbox</title>
</head>
<style>
input[type="checkbox"] {
width: 20px;
height: 20px;
display: inline-block;
text-align: center;
vertical-align: middle;
line-height: 18px;
margin-right: 10px;
position: relative;
}
input[type="checkbox"]::before {
content: "";
position: absolute;
top: 0;
left: 0;
background: #fff;
width: 100%;
height: 100%;
border: 1px solid #d9d9d9;
border-radius: 4px;
background: white;
}
input[type="checkbox"]:checked::before {
content: "\2713";
background-color: #fff;
position: absolute;
top: 0;
left: 0;
width: 100%;
border: 1px solid #d9d9d9;
border-radius:4px;
color: white;
font-size: 20px;
font-weight: bold;
background: rgba(255, 181, 35, 1);
}
input:checked + label {
color: rgba(255, 181, 35, 1);
}
</style>
<body>
<input id="checkbox1" type="checkbox"><label for="checkbox1">CheckBox1</label>
<label><input type="checkbox">CheckBox2</label>
</body>
</html>
效果截图:
如果回答解决了您的问题,还请帮忙采纳。
应该不是吧,winform,devexpress的控件
您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~
如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~
ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632