Bakerh
Bakerh

Reputation: 33

How to Change WinForms Button Color?

I have made 2 buttons inside of a WinForms DataGridView, and now I'd like to change the color of the buttons and set their caption. I looked, but could not find a property to do this; can someone point me in the right direction?

Upvotes: 0

Views: 32765

Answers (3)

Timeless
Timeless

Reputation: 7547

Why not Color.FromArgb?

Button.BackColor = Color.FromArgb(192, 0, 0);

Upvotes: 0

Bala R
Bala R

Reputation: 108997

If it's WPF you can do

 <Button x:Name="Button1" Background="Red" Content="Click Me" />

if it's winforms, you can set BackColor and Text from property grid or from code you could do

button1.BackColor = Color.Red;
button1.Text = "Click Me";

Upvotes: 6

mellamokb
mellamokb

Reputation: 56779

<asp:ButtonField Text="Caption">
    <asp:ControlStyle ForeColor="Red" BackgroundColor="Blue />
</asp:ButtonField>

Upvotes: -3

Related Questions