当前位置:编程学习 > VB >>

CommonDialog的Showcolor选择的颜色,如何转变成HTML里可以表示的颜色?

请指教! --------------------编程问答-------------------- 飘过 --------------------编程问答--------------------
Private Sub Command1_Click()
Dim s As Long, r As Long, g As Long, b As Long, Col As Long
Dim s1 As String
CommonDialog1.ShowColor
s = CommonDialog1.Color
s1 = Hex(s) '转换为16进制字串
s1 = String(6 - Len(s1), "0") & s1
MsgBox s1
r = Val("&H" & Mid(s1, 1, 2))
g = Val("&H" & Mid(s1, 3, 2))
b = Val("&H" & Mid(s1, 5, 2))
MsgBox Mid(s1, 1, 2) & "/" & Mid(s1, 3, 2) & "/" & Mid(s1, 5, 2)
Col = RGB(b, g, r) '这就是网页颜色了,一般为16进制Mid(s1, 5, 2)) & Mid(s1, 3, 2)) &  Mid(s1, 1, 2)
Form1.BackColor = Col

End Sub
--------------------编程问答--------------------
引用 1 楼 veron_04 的回复:
飘过

汗,你好像满论坛飘的啊,时间多啊 
补充:VB ,  基础类
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,