|
-
Feb 26th, 2000, 10:06 PM
#1
Thread Starter
New Member
Me and my friend are making a html editor, just for fun, and we can't get out of this problem:
If we take the commondialog hexidecimal color, how can you convert it to html hex like #FF4455?
I tried hex$(color) where color is a long, the commondialog color returned..
But however, that didn't work. It looks like vb is deleting the 0(s), and only printing F(s), 8(s) and 0(s)..does anyone know how to solve this problem?
Thanks.
-
Feb 26th, 2000, 11:16 PM
#2
Hyperactive Member
A program I made
Hi,
I made a program that does that a bit ago, it isn't great but it works:
Program (EXE): Download
Try this program and if its what you want then I will upload the source aswell. There is not much point in me doing that if its not what you want.
Edited by rino_2 on 02-27-2000 at 11:18 AM
-
Feb 27th, 2000, 03:46 AM
#3
Addicted Member
here try this it does the last couple of letter of the html color here you can figure out the rest
Code:
Private Sub HScroll1_Change()
Dim I
Dim b
Dim C
Picture1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Label1.Caption = "RGB(" & HScroll1.Value & "," & HScroll2.Value & "," & HScroll3.Value & ")"
I = HScroll1.Value + Val(HScroll2.Value)
b = I + Val(HScroll3.Value)
Label2.Caption = Hex(b)
End Sub
Private Sub HScroll2_Change()
Picture1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Label1.Caption = "RGB(" & HScroll1.Value & "," & HScroll2.Value & "," & HScroll3.Value & ")"
I = HScroll1.Value + Val(HScroll2.Value)
b = I + Val(HScroll3.Value)
Label2.Caption = Hex(b)
End Sub
Private Sub HScroll3_Change()
Picture1.BackColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Label1.Caption = "RGB(" & HScroll1.Value & "," & HScroll2.Value & "," & HScroll3.Value & ")"
I = HScroll1.Value + Val(HScroll2.Value)
b = I + Val(HScroll3.Value)
Label2.Caption = Hex(b)
End Sub
-
Feb 27th, 2000, 05:00 AM
#4
Thread Starter
New Member
Thanks for your kind help people, :)
I'm going to try it..the hex codes already worked with rino's program
But..if rino's code uses the same method as xxEvilx's code, then i don't understand why our code didn't work
The code we used was:
Private Sub Command1_Click()
Dim color As Long
CommonDialog1.ShowColor
color = CommonDialog1.Color
RichTextBox1.SelText = "<font color=#" & Hex$(color) & ">" & RichTextBox1.SelText & "</font>"
End Sub
---Fquist
fquist.hypermart.net
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
|