I figured out the cause for the problem. Turns out there's another property (for Buttons and TabPages only, it seems) named UseVisualStyleBackColor It controls whether or not to use "Visual Styles" when calculating the BackColor And to make matters worse, as soon as you set the BackColor it's set to false So I just ended up doing this.
I figured out the cause for the problem. Turns out there's another property (for Buttons and TabPages only, it seems) named UseVisualStyleBackColor. It controls whether or not to use "Visual Styles" when calculating the BackColor.
And to make matters worse, as soon as you set the BackColor, it's set to false. So I just ended up doing this: this. OldUseVisualStyleBackColor = myButton.
UseVisualStyleBackColor; this. OldColor = myButton. BackColor; myButton.
BackColor = Color. Blue; And when I'm ready to reset it: myButton. BackColor = this.
OldColor; myButton. UseVisualStyleBackColor = this. OldUseVisualStyleBackColor; (Yes, you have to reset the BackColor first, and only then set UseVisualStyleBackColor.) I have no idea why the UseVisualStyleBackColor is being used, or why it does what it does, but it seems to work now.
(Thanks, Marc! I wouldn't have found this without your help!).
1 @scraimer: +1. Thanks for documenting this problem. I had a similar problem and found your post via Google.
– Peter Mortensen Feb 5 '10 at 11:00 +1. Never heard of this property before. Thanks a lot!
– tamberg Jul 7 '10 at 10:12.
I suspect the difference is that one is a regular argb color, and one is a system/known color. Controls in . NET keep track of whether the color is explicit (set on this control) or inherited.
This makes it hard to change back properly... but you might be able to do it with PropertyDescriptor, like so: TextBox tb = new TextBox(); tb. BackColor = Color. Red; // now set it back to inherited PropertyDescriptor prop = TypeDescriptor.
GetProperties(tb)"BackColor"; if (prop. CanResetValue(tb)) { prop. ResetValue(tb); } A bit clunky, but it should work.
Wow. That is scary! – scraimer Feb 3 '09 at 10:41.
Or you could just type: TextBox tb = new TextBox(); //Change the Backcolor tb. BackColor = Color. Red; //Resets the Backcolor to its default value, its pretty strange that you don't see the method but it works with allmost all properties tb.ResetBackColor().
Cool! Well, you learn something new every day. I haven't tried it, but I'll try it next time I need this.
Thanks! – scraimer Mar 11 '10 at 23:29.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.