button's default BackColor

Z

Zytan

In the IDE, I changed the BackColor of a button. Then, I changed it
back to what I thought was the default, 'Control'. But, the bolded
text didn't disappear (I think bold means the setting is not the
default), and the button's color looks different from the other normal
buttons. So, I looked at another button to see what the default
BackColor was, and it says 'Control'.

What gives? I can't change the color and change it back within the
IDE? Seems strange.

Zytan
 
M

Marc Gravell

Looking at reflector, it appears to be Color.Empty until changed. Of
course, "Reset" might work (haven't checked).

Marc
 
Z

Zytan

Looking at reflector, it appears to be Color.Empty until changed. Of
course, "Reset" might work (haven't checked).

Something is strange. I did this:
Debug.WriteLine(btnTest.BackColor);
and it shows:
"Color [Control]"
which is the same for all other normal buttons.

I even did this:
btnTest.BackColor = Button.DefaultBackColor;
and it stays the same. If I do that for a normal button, it changes
the button's color! So, Button.DefaultBackColor is not proper!

Zytan
 
Z

Zytan

Of course, "Reset" might work (haven't checked).

I didn't even know about this. thanks, Marc. I can rightclick and
select 'reset'. This makes it non-bold, so it appears to be reset to
the default. But, it doesn't work. the button still has the same
darker shade of gray.

Zytan
 
Z

Zytan

I solved it. In Form1.Designer.cs, it shows:

this.btnTest.UseVisualStyleBackColor = false;

For every other button, is it:

this.btnTest.UseVisualStyleBackColor = true;

So, I change this, and all is well. So, yeah, the backcolor was reset
to its default value, Button.DefaultBackColor, but this is not color
that we see, since this color is not used (unless
UseVisualStyleBackColor = false).

Zytan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top