C# - 更改按钮默认的backgrpound颜色 [英] C# - Change button default backgrpound color

查看:464
本文介绍了C# - 更改按钮默认的backgrpound颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个胜利形式,我知道如何更改按钮的背景颜色它只是简单地



This is a win form, I know how to change a background color of a button its simply

button1.backcolor = color.red;





但我不喜欢它只是一个带有样式按钮的彩色块,我想改变颜色按钮背面颜色背后的背景,例如,如果我按下红色的按钮,它会在它周围有一个带有灰色边框的红色框,我想知道是否有人可以帮助我改变按钮的整个颜色而不仅仅是它中的方框,任何人都可以帮我这个吗?



But I don't like that its just a colored block inside a styled button, I want to change the colour background behind the button back color, for example, if i make the button red, it would hhave a red box in it with a grey border around the edges, I was wondering if anyone can help me change the whole color of the button not just the box in it, can anyone please help me with this?

推荐答案

button1.BackColor = Color.Red;

button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;

button1.FlatAppearance.BorderSize = 0;
button1.BackColor = Color.Red;
button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
button1.FlatAppearance.BorderSize = 0;


< asp:button id =Button1runat = servertext =按钮backcolor =红色bordercolor =#CCCCCCborderstyle =Doubleforecolor =Redxmlns:asp =#unknown>
<asp:button id="Button1" runat="server" text="Button" backcolor="Red" bordercolor="#CCCCCC" borderstyle="Double" forecolor="Red" xmlns:asp="#unknown">


你会有o将ButtonStyle属性更改为Flat ....
You will have to change the ButtonStyle Property to Flat....


这篇关于C# - 更改按钮默认的backgrpound颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆