English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have a schedule that I created that helps plan various aspects of projects. Each project has a color assigned to it, and there may be multiple items on the schedule for each project. Each item on the schedule is represented by a label control, and I am setting the background and foreground colors on those labels. I have two color related questions I would appreciate assistance with.

1. I would like the label forecolor to always be black or white. I need some method for determining when a label's background color is dark enough that a white foreground (text) would be more visible than if the forecolor was black, or vice-versa.

2. If I can't find a good solution to item #1, then I would like some method for limiting the items background colors to only colors "light" enough to look ok with black text. I have tried to use luminesence, but colors with a high luminesence and a high saturation still sometimes look poorly with black text.

Thanks for any ideas you might have!!

2007-02-17 16:26:13 · 2 answers · asked by Lazirell 2 in Computers & Internet Programming & Design

2 answers

Not really answering your question but blue background with luminescent yellow offers best contrast for my eyesight and seems pretty good for most others as well.

2007-02-25 00:43:04 · answer #1 · answered by pilot 5 · 0 0

Apart from the vbred, vbBlue, vbGreen, etc. each color in VB6 can be written with a Hexadecimal number in the format.
&H########&. I am not too sure but it looks like &H0& is vbBlack.

Now you can use this for example.

If lblLable1.backcolor > &H890& then
lblLable1.forecolor = &H0&
end if

You can check your MSDN for the ranges for the various colors.

2007-02-24 06:37:42 · answer #2 · answered by twentoh 1 · 0 0

fedest.com, questions and answers