Reputation: 1308
I have an application where in the end user can change the color of the form, textboxes, labels, buttons during run time. Let us say that if a form is opened and the user has changed the form color from blue to green. To affect the color settings the existing form has to be closed and re-opened as I'm setting the form color in the Form_Load event. I saw many applications where-in the changes of color would apply to all open forms, buttons, labels etc.
Kindly suggest me appropriate methods to achieve dynamic form coloring. Your help is greatly appreciated.
Upvotes: 0
Views: 149
Reputation: 28586
You change the form's BackColor
. Any need to reopen the form.
Change the Backcolor of the form, and recursively the childs, à la:
// forms background color
this.BackColor = yourNewColor
// controls background color
foreach c Control in this.Controls
c.BackColor = yourColor
Upvotes: 1