By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,885 Members | 1,499 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,885 IT Pros & Developers. It's quick & easy.

button's default BackColor

P: n/a
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

Feb 26 '07 #1
Share this Question
Share on Google+
5 Replies


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

Marc

Feb 26 '07 #2

P: n/a
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

Feb 26 '07 #3

P: n/a
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

Feb 26 '07 #4

P: n/a
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

Feb 26 '07 #5

P: n/a
For every other button, is it:
>
this.btnTest.UseVisualStyleBackColor = true;
This can be changed in the GUI, as well.

Zytan

Feb 26 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.