Change Forms BackColor Globally

Kresha7

Member
Joined
Apr 29, 2011
Messages
6
Programming Experience
1-3
Hi everybody,

I have a question how can I change the BackColor of all forms at runtime?

I tried to loop through each form but didn't work for me, so thank in advanced for any help.
 
VB.NET:
For Each form As Form In My.Application.OpenForms
    form.BackColor = Color.BurlyWood
Next
 
Thank you, but it doesn't seem to solve my problem yet, this only changes the color of open forms but what about those forms that are not open?
 
Last edited:
Here My is a namespace, and Application is a property that returns an instance of the MyApplication class. Application class form System.Windows.Forms namespace can also be used.

Another approach could be to bind each forms BackgroundColor property to a application setting, for example bgForm. Then to change background color for all forms you would just set My.Settings.bgForm to a Color value. This way the color would also persist between application runs.
 
Back
Top