PC Review


Reply
Thread Tools Rate Thread

button's default BackColor

 
 
Zytan
Guest
Posts: n/a
 
      26th Feb 2007
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

 
Reply With Quote
 
 
 
 
Marc Gravell
Guest
Posts: n/a
 
      26th Feb 2007
Looking at reflector, it appears to be Color.Empty until changed. Of
course, "Reset" might work (haven't checked).

Marc

 
Reply With Quote
 
Zytan
Guest
Posts: n/a
 
      26th Feb 2007
> 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

 
Reply With Quote
 
Zytan
Guest
Posts: n/a
 
      26th Feb 2007
> 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

 
Reply With Quote
 
Zytan
Guest
Posts: n/a
 
      26th Feb 2007
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

 
Reply With Quote
 
Zytan
Guest
Posts: n/a
 
      26th Feb 2007
> For every other button, is it:
>
> this.btnTest.UseVisualStyleBackColor = true;


This can be changed in the GUI, as well.

Zytan

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
the backcolor of a comand button =?Utf-8?B?UGVsbGVyaXRvQ29uc3VsdGFudHM=?= Microsoft Access 2 21st Jul 2006 11:10 PM
How can I to set Button's Backcolor? Risen Microsoft Dot NET Compact Framework 4 20th Jun 2006 03:19 AM
ToolStrip button BackColor does nothing? MLM450@hotmail.com Microsoft C# .NET 1 16th Nov 2005 06:42 PM
Backcolor of a button Joe Williams Microsoft Access Form Coding 2 1st Dec 2004 12:43 PM
button backcolor propert not available =?Utf-8?B?SGVyYg==?= Microsoft Dot NET Compact Framework 3 10th Jun 2004 10:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:49 PM.