|
-
Sep 25th, 2000, 08:29 PM
#1
Thread Starter
Frenzied Member
Wayne just answered my question on how to get the palette to open, now how do I made it so that it takes the color, convers it into HTML then puts the HTML color code into a textbox
NXSupport - Your one-stop source for computer help
-
Sep 25th, 2000, 09:28 PM
#2
Take a look at this thread.
-
Sep 25th, 2000, 09:40 PM
#3
Thread Starter
Frenzied Member
Thanks, matt, but its kinda confusing, do I add all of that to a module? and do I call to the functions?
can you please like change it a little so that you put in a VB color (i.e. &h001&) into text1 and have it say the html color in text2
NXSupport - Your one-stop source for computer help
-
Sep 26th, 2000, 09:26 AM
#4
Here's a little function you can use:
Code:
Public Function GetHTMLColor(p_Color As Long) As String
Dim strBuffer As String
Dim intLen As Integer
Dim intPad As Integer
strBuffer = Hex(p_Color)
Select Case Len(strBuffer)
Case 1
intPad = 5
Case 2
intPad = 4
Case 3
intPad = 3
Case 4
intPad = 2
Case 5
intPad = 1
End Select
GetHTMLColor = "#" & String(intPad, "0") & strBuffer
End Function
Then you can call this function like this:
Code:
Private Sub Command1_Click()
Dim strHTMLColor As String
strHTMLColor = GetHTMLColor(RGB(10, 125, 255))
MsgBox strHTMLColor
End Sub
-
Sep 26th, 2000, 09:40 AM
#5
transcendental analytic
Or might be easier if you just
Code:
strHTMLcolor = "#" & Right("00000" & Hex(Color),5)
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.
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
|