Click here to Skip to main content
15,921,577 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This is a win form, I know how to change a background color of a button its simply

C#
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?
Posted

button1.BackColor = Color.Red;
button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
button1.FlatAppearance.BorderSize = 0;
 
Share this answer
 
Comments
[no name] 13-Jul-13 9:34am    
not looking for flat style, I want the defalt button style, but a button colur change
<asp:button id="Button1" runat="server" text="Button" backcolor="Red" bordercolor="#CCCCCC" borderstyle="Double" forecolor="Red" xmlns:asp="#unknown">
 
Share this answer
 
Comments
[no name] 13-Jul-13 9:33am    
this code looks promising to what im lookng for, how do you get to this code in C#
[no name] 13-Jul-13 10:00am    
You can get something similar if you are working in WPF application not window application in c#.
when you create a new project lunch it as WpfApplication not WindowsFormsApplication , in wpf you can work more in design then the winform
You will have to change the ButtonStyle Property to Flat....
 
Share this answer
 
v2
Comments
[no name] 13-Jul-13 9:34am    
not looking for flat style, I want the defalt button style, but a button colur change

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900