Sunday, March 14, 2010

How can I easily keep consistent UI settings in C# Winform application?

Programmer Question

I have a lot of different UserControls and would like to maintain consistent UI settings (mainly colors and fonts). My first try was this:



public class UISettings
{
//...
public void SetupUserControl(ref UserControl ctrl)
{
ctrl.BackColor = this.BackColor;
}
}


to be called in every control like this:



settings.SetupUserControl(ref this);


As this is read-only it cannot be passed by ref argument so this does not work. What are other options to keep consistent UI without manually changing properties for every item?



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails