button's default BackColor

  • Thread starter Thread starter Zytan
  • Start date Start date
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
 
Looking at reflector, it appears to be Color.Empty until changed. Of
course, "Reset" might work (haven't checked).

Marc
 
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
 
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
 
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
 
Back
Top