Windows Develop Bookmark and Share   
 index > Windows Forms General > How to programatically change system color settings
 

How to programatically change system color settings

Is there a way in a Windows Forms C# program to programatically change the system colors for the current context?

Like setting the Control color property in the SystemColors namespace during program initialization to a certain value, which would allow all controls which use the Control color property in one of their color properties to be rendered accordingly?

I hope that there is a solution since estting the color properties for each control indivudually seems to be pretty costly & tedious.

Changing the registry is no solution, since the change shall only be valid for the particular application. 

Thanks a lot!

Joerg
MigrationUser 1  Thursday, July 31, 2003 4:40 AM
It sounds like you really don't want to change the SystemColor values (good thing too because your users would be unhappy).  Your only option here, it seems, is to set the colors individually.  At some point you will have to iterate through your controls and set the color which it seems like you want to avoid.  Sorry I don't have an alternative suggestion.
MigrationUser 1  Thursday, July 31, 2003 10:31 AM
my suggestion would be to create a base form, from which all your will inherit from, the form will have a single method ColorChanged,



protected virtual void ColorChanged(Color backColor, Color foreColor)
{

BackColor = backColor;
ForeColor = foreColor;

}

MigrationUser 1  Thursday, July 31, 2003 10:40 PM
Thanks. It appears that not all controls inherit the color setting (e.g. tab control, menu), probably because they do not have a color property. Is custom painting the only solution?

I'm trying to give the controls a unique look & feel. Is there maybe some kind of skin engine which could do the job?
MigrationUser 1  Friday, August 01, 2003 8:28 AM
Someone posted a link to a skinning tool in the Control Gallery forum on this site. . . .Not sure if it'll do the trick for you or not.
MigrationUser 1  Friday, August 01, 2003 10:09 AM

You can use google to search for other answers

Custom Search

More Threads

• Component.Events proeprty - What is it?
• Upgrading from VB.NET 2005 beta 1 to 2 - Threading & Invoking errors - Urgent
• Tabcontrol on a usercontrol does not display active X controls
• Get XP Color Sheme
• How to Persist Scrollbar in the position
• Using PNGs to develop irregularly shaped forms
• Bold Specific Words
• Steam, Runtime error
• Windows Forms Help
• Writing to wwwroot folder from Windows Control Library using Log4Net.dll in Web Application