[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Changing Colors At Runtime.

Posted on 2002-06-09
3
Medium Priority
?
183 Views
Last Modified: 2010-05-02
Hi,

I am having 100 odd forms in my application and there are average 25 controls like textbox,
labels, Picture control etc. on each form.

I want to implement color themes in my application. i.e. the user will choose the theme he would
like to work from the Options Menu and based on his preference I want to change the backcolor
and forecolor properties of each form when the form is loaded.

My questions are:
1. Will it slow down the form loading process if I change the color of each control on form load?
2. Is there another better way of doing stuff like this?

Thanks.
0
Comment
Question by:Sethi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 7066341
Of course, it will slow down your application because more resources are used.

What you may need is the global variables, then save in your memory to keep track what colos/ themes should be used in your application.

Example:

Define a module:

Public mycolor As Long

Sub Main()
   mycolor = RGB(255,0,0) 'Set the default color
   Load frmMain
End Sub

In your form_load event:

Private Sub Form_Load()
    Me.BackColor = mycolor
    'or you can do whatever refer to the global variables' value
End Sub

Hope this is clear and make helps
0
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 200 total points
ID: 7066343
Additional:

To set all color of opened forms:
Dim myForm As Form

For each myForm in Forms
   myForm.BackColor = mycolor
Next

Cheers
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7068414
What I'd recommend is allowing the user to control you application's colors through the Windows theme.

If you keep all of your controls set to the Windows colors (rather than palette colors) then your app will change any time the Windows colors are changed.

For example, command buttons typically have the Backcolor set to &H8000000F&.  On most systems this appears gray/silver, but on system that have alternate Windows themes, this button will appear that same as buttons in other applications.

If you change the Backcolor to &Hc0c0c0, it will appear gray/silver regardless of Windows.  Usually this is considered "unprofessional" so it's nice that you're allowing your users to change colors, but wouldn't they want your app to match all the other apps on their system?  If so don't re-invent the wheel; just use system colors on all your controls.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question