Set Backcolor for forms

  • Thread starter Thread starter spaulsamin
  • Start date Start date
S

spaulsamin

Hi

I need to set the backcolor to all forms under my project with one
command

not by opening each form and do it

i think , something to do with MDI or Assembly or by some system
namespace, but i am not sure

Pls help me with example

Thank You
 
spaulsa wrote:
I need to set the backcolor to all forms under my project with one
command

not by opening each form and do it
<snip>

VB Express, here.

One possible way of doing it is to create a global setting for the
color, say "DefaultBackColor":

At design time, open the application settings (in the Project menu),
go to the "Settings" tab and create a new setting called
"DefaultBackColor" (or whatever name suits you better), of type
System.Drawing.Color.

Then (still in design mode), open each Form Property binding: in the
form's property panel, expand "(Application Settings)" and click the
ellipsis button next to the "(Property Bindings)" entry to bring up
its dialog. Then look up "BackColor" and associate it with the
"DefaultBackColor" property you created. Do that to each of your
forms.

Finaly, at runtime, when you want to change the BackColor of the forms
associated with the DefaultBackColor property, just set
My.Settings.DefaultBackColor to the new color, and all the forms will
change color accordingly.

HTH.

Regards,

Branco.
 
spaulsa wrote:




<snip>

VB Express, here.

One possible way of doing it is to create a global setting for the
color, say "DefaultBackColor":

At design time, open the application settings (in the Project menu),
go to the "Settings" tab and create a new setting called
"DefaultBackColor" (or whatever name suits you better), of type
System.Drawing.Color.

Then (still in design mode), open each Form Property binding: in the
form's property panel, expand "(Application Settings)" and click the
ellipsis button next to the "(Property Bindings)" entry to bring up
its dialog. Then look up "BackColor" and associate it with the
"DefaultBackColor" property you created. Do that to each of your
forms.

Finaly, at runtime, when you want to change the BackColor of the forms
associated with the DefaultBackColor property, just set
My.Settings.DefaultBackColor to the new color, and all the forms will
change color accordingly.

HTH.

Regards,

Branco.

Hello Branco

Thanks for explanation, but I've asked for vb.net.

paul
 
Hi,
You can create class with static variable containing backround color of the
form add just a one line of code on all formm (Form Load Event) & when ever
you want to change color of tha form just change static variable content.

Cheers
Chetan Chaphekar
 
HI,

I am talking about VB.NET only, You can create static class in VB.NET

Cheers
Chetan
 
Back
Top