|
-
May 21st, 2000, 09:16 PM
#1
Thread Starter
Addicted Member
Hi,
I was just wondering if there is a way to convert a VB color code to html color code ?
Thanks
-
May 22nd, 2000, 06:45 AM
#2
transcendental analytic
Vb color code is a decimal value stored in a long and html is a hex value stored in a string. just convert between them using
Code:
htmlcolor = Hex(vbcolor)
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 22nd, 2000, 11:21 AM
#3
Thread Starter
Addicted Member
Hi Kedaman,
R U Sure? I try That and it is not the same.
HtmlColor = hex(vbred)
???
-
May 22nd, 2000, 12:30 PM
#4
Member
Code:
Public Function FormatRGBString(val As Long) As String
Dim color As String
Dim pad As Long
Dim r As String
Dim g As String
Dim b As String
' This function formats a long consisting of rgb values
' taken from the CommonDialog color dialog
' to a string in the form of "#RRGGBB" where RRGGBB are
' hex values
' convert to hex
color = Hex(val)
'determine how many zeros to pad in front of converted value
pad = 6 - Len(color)
If pad Then
color = String(pad, "0") & color
End If
'Extract the rgb components
r = Right(color, 2)
g = Mid(color, 3, 2)
b = Left(color, 2)
' Swab r and b position, color dialog returns
' bgr instead of rgb
color = "#" & r & g & b
FormatRGBString = color
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|