Changing the color of open form
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 m开发者_如何学Cany 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.
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
精彩评论