Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 150,075 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,783 people online right now. Registration is fast and FREE... Join Now!




background colour

 
Reply to this topicStart new topic

background colour, change

shazron
3 Jun, 2008 - 06:11 AM
Post #1

New D.I.C Head
*

Joined: 28 May, 2008
Posts: 5

hello
so far i have allowed the user of my program to change the background colour of a form with a click of a button...unfortunately it only works for the form which is currently in use and there are about 13 forms in my project...i was wondering if any one knows how to apply the backgorund colour change to all forms on my background

here is code for changing the colour of one form

Me.BackColor = myDialog.Color
thanx


User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Background Colour
3 Jun, 2008 - 06:43 AM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 9,483



Thanked: 161 times
Dream Kudos: 9075
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
I would do that with application settings, using the My.Settings Object. You could create a setting named BGColor and set it's type to System.Drawing.Color. Then when the color is set by the user save it to that setting


vb

'Set the new color
My.Settings.BGColor = MyDialog.Color
'Save the settings (so they're persisted)
My.Settings.Save()


This will persist the color (and will also load that color next time the user runs your application. Then, in your form's Load event set the color of the form that is loading


vb

'Set the background color of the form
Me.BackColor = My.Settings.BGColor



That line will need to be added to each form when it loads. Unfortunately, unless I have missed something, there isn't a way to set all the forms in a nice single statement, each has to be set manually.

One thing to remember, before applying the color in your application setting make sure it actually exists first, or set a default value for it. Read through that link I provided, there is some good information there, and at the bottom is a few links to show how to use what I'm talking about smile.gif

Hope that helps
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 11:11PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month