From: Rick Rothstein (MVP - VB) on
>>> VB6 uses hexadecimals to define color of forms and text. Is there a
>>> program or some way that I can obtain the following for these 4 colors?
>>>
>>> Light Blue = &H00FFFFC0&
>>> Light Yellow = &H00C0FFFF&
>>> Light Red = &H00C0C0FF&
>>> Light Green = &H00C0FFC0&
>>>
>>> I need the Hue, Sat, Lum, Red, Green and Blue numerical values of each
>>> color.
>>
>> Not sure about Hue, Sat and Lum, but Red, Green and Blue solutions
>> abound. Here is one...
>>
>> Red = ColorValue And &HFF&
>>
>> Green = (ColorValue And &HFF00&) \ &H100&
>>
>> Blue = (ColorValue And &HFF0000) \ &H10000
>>
>> For example, use &H00FFFFC0& for the ColorValue for your light blue
>> color.
>>
>> Rick
>
> How do I get the color value? I have the hex value.

That hex value IS the ColorValue. VB can accept numerical values in decimal
or hex (or even octal).

ColorValue = &H00FFFFC0&
Red = ColorValue And &HFF&
Green = (ColorValue And &HFF00&) \ &H100&
Blue = (ColorValue And &HFF0000) \ &H10000

Try it out.

Rick


From: Larry Serflaten on

"Jim Y" <jj819stuffNOSPAM(a)comcast.net> wrote


> How do I get the color value? I have the hex value.

The hex value is the color value. The hex represents
the Blue, Green, and Red values in 1-byte hex format:

xx BB GG RR
Light Blue: 00 FF FF C0

Set a form's backcolor to some palette color then
check the backcolor property. It should be showing
you the hex value, which is the color value you
selected....

LFS



From: Jim Y on

"Larry Serflaten" <serflaten(a)usinternet.com> wrote in message
news:Oj%23QDPE5GHA.3836(a)TK2MSFTNGP06.phx.gbl...
>
> "Jim Y" <jj819stuffNOSPAM(a)comcast.net> wrote
>
>
>> How do I get the color value? I have the hex value.
>
> The hex value is the color value. The hex represents
> the Blue, Green, and Red values in 1-byte hex format:
>
> xx BB GG RR
> Light Blue: 00 FF FF C0
>
> Set a form's backcolor to some palette color then
> check the backcolor property. It should be showing
> you the hex value, which is the color value you
> selected....
>
> LFS
Obviously I am not explaining my problem. The graphics program accepts the RGB numerical values
only. For example, for the light red, it requires the RGB values of 255, 224, 224 which correspond
(close, not exact) to the hexadecimal values of C0C0FF. How do I obtain 224 from C0? 255 from FF?
If I remember, C is 13 and 0 is 10, F is 15.

I have the hex values from the Properties color palette in VB6. That is where I got the hex values
of the 4 colors in my original post and the basis of the colors that I need to put into the graphics
program that I am using. I found a conversion calculator on the net, but am having trouble getting
the shade of color that I want. I know the colors will differ on different monitors. I want light
shades of the colors. That is why I am using the color palette in VB6 as a starting place.

Thank you,
Jim Y


From: Larry Serflaten on

"Jim Y" <jj819stuffNOSPAM(a)comcast.net> wrote
> For example, for the light red, it requires the RGB values of 255, 224, 224 which correspond
> (close, not exact) to the hexadecimal values of C0C0FF. How do I obtain 224 from C0? 255 from FF?
> If I remember, C is 13 and 0 is 10, F is 15.

Form1.BackColor = &HC0C0FF
Form1.BackColor = RGB(&HFF, &HC0, &HC0)
Form1.BackColor = RGB(255, 224, 224)

These three statements produce the exact same color. You already
have the hex values, so use them in your calls. Unless you need
to send text, hex and decimal values are equivalent / interchangeable.

In the Hex notation, the order is BBGGRR
In the RGB function, the order is RR, GG, BB

Experiment with it a little, it is not difficult....

LFS


From: Dmitriy Antonov on

"Jim Y" <jj819stuffNOSPAM(a)comcast.net> wrote in message
news:8tCdnZ0eQfHfaIDYnZ2dnUVZ_u6dnZ2d(a)comcast.com...
>
> "Larry Serflaten" <serflaten(a)usinternet.com> wrote in message
> news:Oj%23QDPE5GHA.3836(a)TK2MSFTNGP06.phx.gbl...
>>
>> "Jim Y" <jj819stuffNOSPAM(a)comcast.net> wrote
>>
>>
>>> How do I get the color value? I have the hex value.
>>
>> The hex value is the color value. The hex represents
>> the Blue, Green, and Red values in 1-byte hex format:
>>
>> xx BB GG RR
>> Light Blue: 00 FF FF C0
>>
>> Set a form's backcolor to some palette color then
>> check the backcolor property. It should be showing
>> you the hex value, which is the color value you
>> selected....
>>
>> LFS
> Obviously I am not explaining my problem. The graphics program accepts
> the RGB numerical values only. For example, for the light red, it
> requires the RGB values of 255, 224, 224 which correspond (close, not
> exact) to the hexadecimal values of C0C0FF. How do I obtain 224 from C0?
> 255 from FF? If I remember, C is 13 and 0 is 10, F is 15.
>
> I have the hex values from the Properties color palette in VB6. That is
> where I got the hex values of the 4 colors in my original post and the
> basis of the colors that I need to put into the graphics program that I am
> using. I found a conversion calculator on the net, but am having trouble
> getting the shade of color that I want. I know the colors will differ on
> different monitors. I want light shades of the colors. That is why I am
> using the color palette in VB6 as a starting place.
>
> Thank you,
> Jim Y
>

Try this in the Immediate window:

?CLng("&HC0")
192
?CLng("&HFF")
255


As you can see CO in hex is not 224 but rather 192. And hex of 224 is E0.

?Hex(224)
E0

Those values from the properties window are all RGB and the most significant
byte is not used - it is always 00, as far as I know. Only system colors use
that byte and, I think it is always 80, which is just a sign - means they
are always negative values in a signed presentation of 32 bit value.

For a proper way of extracting each color's value see Rick's answers above.

Dmitriy.




First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8
Prev: VB application to AS400 Emulator
Next: Vb6 Project won't load