?
Solved

Changing Colors At Runtime.

Posted on 2002-06-09
3
Medium Priority
?
182 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

764 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