JohnSaps
JohnSaps

Reputation: 622

"Bind" properties of components to a constant to enable global change

I am experiencing with different layouts for my application.

The application consists of many buttons, panel etc., which are all created and visible at design time in Visual Studio.

In one layout the BackColors of all controls are e.g. gray, in a different approach I will change the BackColors to e.g. dark gray to see if this looks better.

Until now I'm doing the color property change by:

Is it in some way possible to e.g. "bind" specific properties of controls to e.g. a constant defined in a separate class, so when changing this property the properties of all associated controls will change accordantly (at design-time)?

Any help is appreciated!

Upvotes: 0

Views: 93

Answers (1)

John Arlen
John Arlen

Reputation: 6689

An option is to create an Application Setting (double-click 'Settings.settings' file) of type System.Drawing.Color named (for example) ControlBackColor: enter image description here

Then in the designer, set the (ApplicationSettings) binding for the controls you wish: enter image description here

Now by just changing the Settings.settings location - the control settings will be modified.

Upvotes: 2

Related Questions