|
楼主 |
发表于 2023-3-27 19:13
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
看一下以下代码要怎样修改一下就楞以实现?谢谢!
Private Sub A_AfterUpdate()
Me.Refresh
Dim R As Integer
Dim G As Integer
Dim B2 As Integer
If [L] >= 95 Then
[R] = 255
[G] = 255
[B] = 255
ElseIf [L] <= 10 Then
[R] = 0
[G] = 0
[B] = 0
Else
If [A] >= -0.5 And [A] <= 0.5 And [B1] >= -0.5 And [B1] <= 0.5 Then
[R] = 255 * [L] / 100
[G] = 255 * [L] / 100
[B] = 255 * [L] / 100
Else
[R] = -13.54 + 2.6835 * [L] + 2.685 * [A] + 0.6817 * [B1] - 0.05049 * [A] * [A] - 0.02168 * [B1] * [B1] + 0.000513 * [A] * [A] * [A] + 0.000244 * [B1] * [B1] * [B1]
[G] = 15.6 + 1.668 * [L] - 0.08041 * [A] + 0.00733 * [L] * [L]
[B] = -10.05 + 2.6045 * [L] + 0.0594 * [A] - 1.4425 * [B1] - 0.00121 * [B1] * [B1] - 0.004001 * [L] * [B1] - 0.000063 * [B1] * [B1] * [B1]
End If
End If
If [R] < 0 Then
R = 0
Else
R = [R]
End If
If [G] < 0 Then
G = 0
Else
G = [G]
End If
If [B] < 0 Then
B2 = 0
Else
B2 = [B]
End If
[color].BackColor = RGB(R, G, B2)
End Sub
Private Sub B1_AfterUpdate()
Me.Refresh
Dim R As Integer
Dim G As Integer
Dim B2 As Integer
If [L] >= 95 Then
[R] = 255
[G] = 255
[B] = 255
ElseIf [L] <= 10 Then
[R] = 0
[G] = 0
[B] = 0
Else
If [A] >= -0.5 And [A] <= 0.5 And [B1] >= -0.5 And [B1] <= 0.5 Then
[R] = 255 * [L] / 100
[G] = 255 * [L] / 100
[B] = 255 * [L] / 100
Else
[R] = -13.54 + 2.6835 * [L] + 2.685 * [A] + 0.6817 * [B1] - 0.05049 * [A] * [A] - 0.02168 * [B1] * [B1] + 0.000513 * [A] * [A] * [A] + 0.000244 * [B1] * [B1] * [B1]
[G] = 15.6 + 1.668 * [L] - 0.08041 * [A] + 0.00733 * [L] * [L]
[B] = -10.05 + 2.6045 * [L] + 0.0594 * [A] - 1.4425 * [B1] - 0.00121 * [B1] * [B1] - 0.004001 * [L] * [B1] - 0.000063 * [B1] * [B1] * [B1]
End If
End If
If [R] < 0 Then
R = 0
Else
R = [R]
End If
If [G] < 0 Then
G = 0
Else
G = [G]
End If
If [B] < 0 Then
B2 = 0
Else
B2 = [B]
End If
[color].BackColor = RGB(R, G, B2)
End Sub
Private Sub Command22_Click()
Me.Refresh
Dim R As Integer
Dim G As Integer
Dim B2 As Integer
If [L] >= 95 Then
[R] = 255
[G] = 255
[B] = 255
ElseIf [L] <= 10 Then
[R] = 0
[G] = 0
[B] = 0
Else
If [A] >= -0.5 And [A] <= 0.5 And [B1] >= -0.5 And [B1] <= 0.5 Then
[R] = 255 * [L] / 100
[G] = 255 * [L] / 100
[B] = 255 * [L] / 100
Else
[R] = -13.54 + 2.6835 * [L] + 2.685 * [A] + 0.6817 * [B1] - 0.05049 * [A] * [A] - 0.02168 * [B1] * [B1] + 0.000513 * [A] * [A] * [A] + 0.000244 * [B1] * [B1] * [B1]
[G] = 15.6 + 1.668 * [L] - 0.08041 * [A] + 0.00733 * [L] * [L]
[B] = -10.05 + 2.6045 * [L] + 0.0594 * [A] - 1.4425 * [B1] - 0.00121 * [B1] * [B1] - 0.004001 * [L] * [B1] - 0.000063 * [B1] * [B1] * [B1]
End If
End If
If [R] < 0 Then
R = 0
Else
R = [R]
End If
If [G] < 0 Then
G = 0
Else
G = [G]
End If
If [B] < 0 Then
B2 = 0
Else
B2 = [B]
End If
[color].BackColor = RGB(R, G, B2)
End Sub
Private Sub L_AfterUpdate()
Me.Refresh
Dim R As Integer
Dim G As Integer
Dim B2 As Integer
If [L] >= 95 Then
[R] = 255
[G] = 255
[B] = 255
ElseIf [L] <= 10 Then
[R] = 0
[G] = 0
[B] = 0
Else
If [A] >= -0.5 And [A] <= 0.5 And [B1] >= -0.5 And [B1] <= 0.5 Then
[R] = 255 * [L] / 100
[G] = 255 * [L] / 100
[B] = 255 * [L] / 100
Else
[R] = -13.54 + 2.6835 * [L] + 2.685 * [A] + 0.6817 * [B1] - 0.05049 * [A] * [A] - 0.02168 * [B1] * [B1] + 0.000513 * [A] * [A] * [A] + 0.000244 * [B1] * [B1] * [B1]
[G] = 15.6 + 1.668 * [L] - 0.08041 * [A] + 0.00733 * [L] * [L]
[B] = -10.05 + 2.6045 * [L] + 0.0594 * [A] - 1.4425 * [B1] - 0.00121 * [B1] * [B1] - 0.004001 * [L] * [B1] - 0.000063 * [B1] * [B1] * [B1]
End If
End If
If [R] < 0 Then
R = 0
Else
R = [R]
End If
If [G] < 0 Then
G = 0
Else
G = [G]
End If
If [B] < 0 Then
B2 = 0
Else
B2 = [B]
End If
[color].BackColor = RGB(R, G, B2)
End Sub
|
|