谁看看这段函数是得到什么样的结果.
Private Function ShiftColor(ByVal Color As Long, ByVal Value As Long, Optional isXP As Boolean = False) As Long
'this function will add or remove a certain color
'quantity and return the result
Dim Red As Long, Blue As Long, Green As Long
If isXP = False Then
Blue = ((Color \ &H10000) Mod &H100) + Value
Else
Blue = ((Color \ &H10000) Mod &H100)
Blue = Blue + ((Blue * Value) \ &HC0)
End If
Green = ((Color \ &H100) Mod &H100) + Value
Red = (Color And &HFF) + Value
'check red
If Red < 0 Then
Red = 0
ElseIf Red > 255 Then
Red = 255
End If
'check green
If Green < 0 Then
Green = 0
ElseIf Green > 255 Then
Green = 255
End If
'check blue
If Blue < 0 Then
Blue = 0
ElseIf Blue > 255 Then
Blue = 255
End If
ShiftColor = RGB(Red, Green, Blue)
End Function
调用: cShadow = ShiftColor(cFace, -&H40)
cLight = ShiftColor(cFace, &H1F)
cHighLight = ShiftColor(cFace, &H2F) 'it should be 3F but it looks too lighter
cDarkShadow = ShiftColor(cFace, -&HC0)