Reputation: 1319
I am expecting the text on GroupBox caption and Button caption to be the same color if they have the same ForeColor (as well as other controls set similarly).
The ForeColor property of a GroupBox and several Buttons are each set to ControlText, but they render as blue (groupbox) and black (buttons). Assuming these match the current XP Theme. The question is how do I set the properties on these controls, or Winforms controls generally, such that their behavior is consistent and expected? Or is it correct already and I am misunderstanding?
Upvotes: 0
Views: 151
Reputation: 941217
That's not in general how theming works. It overrides the default properties of controls according to the user selected theme. A more stark example is ProgressBar.ForeColor, it's going to be the pulsing green bar on Vista, no matter what color you select in the designer.
Fwiw, there's a fair amount of pain you can get into when you try to override this. GroupBox.ForeColor is a very notable example. It is only going to have the theme color (it is faked btw) if you never assign ForeColor yourself. Once you do, you can never reset it back. Even if you assign ControlText again you'll get black, not the theme color. This is somewhat inevitable from the way 'ambient properties' are implemented in Windows Forms. Calling it a bug would not be unjustified. Not tinkering with it is the best way to avoid this trouble, your user isn't going to be complaining.
Upvotes: 1