- '//取各顏色分量
- Public Function GetRedValue(COLOR As Long) As Integer '取得紅色值
- GetRedValue = COLOR And
- End Function
- Public Function GetGreenValue(COLOR As Long) As Integer '取得綠色值
- GetGreenValue = (COLOR And 65280) / 256
- End Function
- Public Function GetBlueValue(COLOR As Long) As Integer '取得藍色值
- GetBlueValue = (COLOR And &HFF0000) / 65536
- End Function
- '//將RGB轉化爲HTML顏色.
- Public Function GetHexColor(Red As Integer, Green As Integer, Blue As Integer) As String
- '將RGB顏色轉換爲HTML顏色
- Dim StrRed As String, StrGreen As String, StrBlue As String
- StrRed = Hex(Red)
- StrGreen = Hex(Green)
- StrBlue = Hex(Blue)
- If Red <= 16 Then StrRed = "0" & StrRed
- If Green <= 16 Then StrGreen = "0" & StrGreen
- If Blue <= 16 Then StrBlue = "0" & StrBlue
- GetHexColor = StrRed & StrGreen & StrBlue
- End Function
VB取各顏色分量,將RGB轉爲HTML顏色.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.