locking form color (1 Viewer)

wizcow

Registered User.
Local time
Yesterday, 20:43
Joined
Sep 22, 2001
Messages
236
hi

can i set the form color to be amune to regional settings?
or have a label's back color change with the regional settings?

i am try to mimic the look of ms forms by biulding an etched rectangle around a number of controls. i have a label over the top left corner of the rectangle, this names the group of controls.

my form is standard grey. i set the label's back color to the same grey, so as cover the portion of rectangle it is sitting on.

the problem:
regional settings can change the form color, (to say, beige) but the label's back color stays grey.

Thanks
Tom

[This message has been edited by wizcow (edited 11-19-2001).]
 

axa

Registered User.
Local time
Today, 03:43
Joined
Mar 9, 2001
Messages
31
wizcow,

It is easy to get Label controls to do what you want. Set the BackStyle property of your labels to 'Tansparent' and they will pick up the underlying background colour of the form (which by default uses the Windows System defined background colour).

So far so good, some other controls do not always play as fair as the Label control in this matter however. Also if you have set a forms background color to another colour, and then set it back to the light gray colour that you normally expect, you will find your form will no longer adhere to changes in the Windows System colours. This is because windows/vb uses special colour values that are outside of the normal RGB addressing range as a place holder to indicate that a particular object will use one of the particular System colors.

The default system colour used for vb forms is the one that is defined as 'Button Face', there is a constant named vbButtonFace which you can use in code. The numerical value of vbButtonFace is -2147483633 (or 0x8000000F in hex. Note: in vb you must use hex values with the prefix of '&H' instead of the standard '0x' that you often see in docmentation, so enter this value as &H8000000F) which you can enter as a colour value in any Color type property for VB Controls.

Look in the help files for a topic named 'System Color Constants' for a list of other system colour values you can play with.

Hope that helps.

axa
 

wizcow

Registered User.
Local time
Yesterday, 20:43
Joined
Sep 22, 2001
Messages
236
that sounds simple.
Thanks
Tom
 

Users who are viewing this thread

Top Bottom