Function ColorGroup(首颜色, 尾颜色, 个数) '根据首尾颜色按照个数进行拆分出系列渐变色
Dim CC1&, CC2&, CE1&, CE2&, CE3&, DLT1, DLT2, DLT3, XX1&, C1R, C1G, C1B, C2R, C2G, C2B, TempArr, NN1&, iX&
CC1 = 首颜色
CC2 = 尾颜色
NN1 = 个数
C1R = CC1 Mod 256
C1G = (CC1 - C1R) / 256 Mod 256
C1B = (CC1 - C1R - C1G * 256) / 256 ^ 2
C2R = CC2 Mod 256
C2G = (CC2 - C2R) / 256 Mod 256
C2B = (CC2 - C2R - C2G * 256) / 256 ^ 2
CE1 = C2R - C1R
CE2 = C2G - C1G
CE3 = C2B - C1B
DLT1 = CE1 / (NN1 - 1)
DLT2 = CE2 / (NN1 - 1)
DLT3 = CE3 / (NN1 - 1)
ReDim TempArr(0 To NN1 - 1)
For iX = 0 To NN1 - 1
TempArr(iX) = RGB(C1R + DLT1 * XX1, C1G + DLT2 * XX1, C1B + DLT3 * XX1)
XX1 = XX1 + 1
Next
ColorGroup = TempArr
End Function |