Based on your description and comments, you'll need to reload your form for the colors and graphics. You can do it in one of the 3 ways:
- Call
InitializeComponent()
after you return from your settings dialog. This might be dangerous because InitializeComponent()
will do other startup stuff too.
- Reload your main form too after returning from settings dialog. You may or may not be able to do that based on the state of your main form.
- Collect all the code that updates colors and graphics from
InitializeComponent()
and move it into a separate function. Call it after InitializeComponent()
as well as when returning from your settings dialog.
I think the 3rd one would be the cleanest approach.
Edit
Another and generally much more clean way of doing this is through the use of Application Settings. You just go to your form designer, select your control and choose Application Settings from Properties window. Choose the property that you want to bind to a setting and then choose the corresponding setting from the dropdown. If the setting doesn't already exist, you just click the New button and the designer creates one for you.
These settings automatically get loaded and saved for you. No more manual stuff.
Edit 2
For immediate propagation of settings into control properties, you may need to change the default update event when binding your to your setting. To do that, go to your designer file and look for property binding statements:
this.TextBox1.DataBindings.Add("Text", Project1.Properties.Settings.Default.UserName, ""))
and set them to update immediately upon property change:
this.TextBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", global::Project1.Properties.Settings.Default, "UserName", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));