Convert Common Dialog Control Color to WEB Hex
This code takes the common dialog color, extracts the R, G, B values, and converts each value to the correct HEX equivilant supported by HTML.
AI
AI 요약: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
소스 코드
Private Function HexRGB(lCdlColor As Long)
Dim lCol As Long
Dim iRed, iGreen, iBlue As Integer
Dim vHexR, vHexG, vHexB As Variant
'Break out the R, G, B values from the common dialog color
lCol = lCdlColor
iRed = lCol Mod &H100
lCol = lCol \ &H100
iGreen = lCol Mod &H100
lCol = lCol \ &H100
iBlue = lCol Mod &H100
'Determine Red Hex
vHexR = Hex(iRed)
If Len(vHexR) < 2 Then
vHexR = "0" & vHexR
End If
'Determine Green Hex
vHexG = Hex(iGreen)
If Len(vHexG) < 2 Then
vHexG = "0" & iGreen
End If
'Determine Blue Hex
vHexB = Hex(iBlue)
If Len(vHexB) < 2 Then
vHexB = "0" & vHexB
End If
'Add it up, return the function value
HexRGB = "#" & vHexR & vHexG & vHexB
End Function
원본 댓글 (3)
Wayback Machine에서 복구됨