Color of form elements under programmatic control?

PaulWilson

Registered User.
Local time
Today, 08:01
Joined
May 19, 2011
Messages
43
I have lots of forms which all look the same as they are based on a template. They look like a website with a header bar, a sidebar on the left for navigation and a body section with the logo in the top left.

It may sound silly, but I need to place the colors of form elements (header background color, dividing line color, body background color) under programmatic control. I need to change the colors after start-up based on who logs in to the database. We have one manager who favors one college sporting team (Carolina Blue and White) another who favors a different color scheme (Duke blue) and a third who likes Clemson orange, white and purple.

Is there a "best way" to do that? Does anyone know of a good example?

PaulWilson
 
Paul,
I wasn't just passing a link. I was trying to give you a sample of what someone had tried and used. This was the message in the thread

You have to change the different sections:

Me.Detail.BackColor = vbRed
Me.FormHeader.BackColor = vbRed
Me.FormFooter.BackColor = vbRed

If you want to get a specific colour, change the colour in the design view to find the colour you want - then copy the number from the "Back Color" (American spelling!) property under the format tab in the properties for that section.

E.g. Me.Detail.BackColor = -2147483633 (Default colour for MS Access 2002.)

Hope this helps. :-)

However, it seems you have a link (example) with instructions on how to do what you asked. What's the issue?

A table of options based on User would seem a reasonable approach.
 
My thanks.
Sorry if I did offend...I love such links!

I'm reluctant to have user preferences go with the machine. The implication is that the user has the priviledge of writing to the registry. That's often not the case. Between your link, that link I found and one by Allen Browne, I'm hatching a plan. The idea is to have what Allen Browne calls a tblSys and what Helen Feddema calls tblInfo. A place to store preferences and settings. I'll have to map a user table to the info table and thus users with their color preferences.


PaulWilson
 
While we're discussing color schemes, I like to leave much of the color up to the individual users, by using Windows' Color IDs. Essentially this means that the database's color scheme will be determined by the color scheme the user has chosen in Windows as his/her preference.

I usually use a gray (sometimes light, sometimes dark) as the form background (picked using the color palette) but then use a Color ID code for label backgrounds, buttons, frames, etc. I usually set all three of these to

-2147483646 (Active window title bar)

which means that the user's choice for Active window title bar will be seen in these controls on the screen. Setting all three of these to the same Color ID means that the screen will have a coordinated look. The gray background is neutral so that it will go fairly well with the user's choices, whether they be staid colors such as maroon or dark blue, or day-glo colors such as yellows or oranges.

Just place any of the Color IDs in the control's color property box and leave the rest to Windows. Be sure to preface the ID # with the minus (-) sign; this tells Windows that the number is a Color ID number.

Color ID... Color Description
-2147483648 Scroll bar
-2147483647 Desktop
-2147483646 Active window title bar
-2147483645 Inactive window title bar
-2147483644 Menu bar
-2147483643 Window
-2147483642 Window frame
-2147483641 Menu Text
-2147483640 Window Text
-2147483639 Title bar text
-2147483638 Active window border
-2147483637 Inactive window border
-2147483636 Application background
-2147483635 Highlight
-2147483634 Highlight Text
-2147483633 3-D face
-2147483632 3-D shadow
-2147483631 Dimmed (disabled) text
-2147483630 Button Text
-2147483629 Inactive window title bar text
-2147483628 3-D highlight
-2147483627 3-D dark shadow
-2147483626 3-D light
-2147483625 ToolTip Text
-2147483624 ToolTip background
-2147483621 Active window title bar color2

Linq ;0)>
 
I agree with the approach of a user preferences or options table. I didn't care much for writing to the registry.
You mentioned some great references in Allen Browne and Helen Feddema -- solid folks.

Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom