- Home
·
- Graphics
·
- Very useful code to convert long to rgb, rgb to long, rgb to hex and qbcolor to rgb
Very useful code to convert long to rgb, rgb to long, rgb to hex and qbcolor to rgb
Very useful code to convert long to rgb, rgb to long, rgb to hex and qbcolor to rgb
Rate Very useful code to convert long to rgb, rgb to long, rgb to hex and qbcolor to rgb
(1(1 Vote))
Public Green As Integer
Public Blue As Integer
Public Sub ConvertQBColorToRGB(QBColorValue As Integer)
If QBColorValue < 0 Or QBColorValue > 15 Then MsgBox "There's error in your QBColor.", vbCritical, "Error"
ConvertLongToRGB (QBColor(QBColorValue))
End Sub
Public Function ConvertRGBToHex(RedColor As Integer, GreenColor As Integer, BlueColor As Integer)
On Error GoTo ErrorInLongColor
ConvertRGBToHex = Right(0 & Hex(RedColor), 2) & Right(0 & Hex(GreenColor), 2) & Right(0 & Hex(BlueColor), 2)
Exit Function
ErrorInLongColor:
MsgBox "There's error in your RGB color.", vbCritical, "Error"
End Function
Public Sub ConvertLongToRGB(Color As Long)
On Error GoTo ErrorInLongColor
Blue = Color \ 65536
Green = (Color - Blue * 65536) \ 256
Red = Color - (Blue * 65536) - (Green * 256)
Exit Sub
ErrorInLongColor:
MsgBox "There's error in your long color.", vbCritical, "Error"
End Sub
Public Function ConvertRGBToLong(RedColor As Integer, GreenColor As Integer, BlueColor As Integer)
On Error GoTo ErrorInLongColor
ConvertRGBToLong = RGB(RedColor, GreenColor, BlueColor)
Exit Function
ErrorInLongColor:
MsgBox "There's error in your RGB color.", vbCritical, "Error"
End Function
Very useful code to convert long to rgb, rgb to long, rgb to hex and qbcolor to rgb Comments
No comments yet — be the first to post one!
Post a Comment