You can use the (ApplicationSettings)
property, accessible from the Form Designer’s Properties
panel. Expand ApplicationSettings
, open up the PropertyBinding
dialog, add a Setting to the BackColor
property (e.g., CommonFormBackColor
) and use the same setting for all Forms.
You can create the Setting directly in the Application Settings’ PropertyBinding
dialog:
This new Setting is created in the User Scope.
All settings in the User Scope are applied on a per-User basis and can be changed.
Settings in the Application Scope are considered read-only.
The new Setting will then appear under the ApplicationSettings
expandable property:
Assign the same Setting to all Forms that should change their BackColor when this setting is changed.
You can of course assign a common Setting to any other Property of any other Control.
The use of a Form Template (or a base Form class) can automate the whole process.
When the Setting value is changed at run-time, all opened Forms – and those that will be opened later – will present the same BackColor
.
You can set a new value to all Form’s BackColor changing the Settings’s Value:
(all opened Form that share the same Setting for the BackGround
Color will change color immediately)
Properties.Settings.Default.CommonFormBackColor = Color.Orange;
You can save the current Settings selection (to preserve the value assigned in the current session, so it will be used again when the application is restarted) with:
Properties.Settings.Default.Save();
You can reset the default value (the value originally assigned to the Settings in the Designer) calling:
Properties.Settings.Default.Reset();