Вопрос
Как узнать, сколько в данном цвете (например, в Me.BackColor) красного, сколько зеленого и синего?
Ответ
Public Function Test()
Dim R As Long, G As Long, B As Long
LongToRGB vbWhite, R, G, B
Debug.Print "R: " & R & " G: " & G & " B: " & B
End Function
Public Function LongToRGB(ByVal Color As Long, ByRef R As Long, ByRef G As Long,
ByRef B As Long)
B = Color \ 256 ^ 2
G = (Color — B * 256 ^ 2) \ 256
R = Color — G * 256 — B * 256 ^ 2
End Function
Артем Кривокрисенко
Private Type D3STYPE
Rd3s As String
Gd3s As String
Bd3s As String
End Type
Dim D3S As D3STYPE
Function POINT_TO_RGB(PIC_POINT As Long) As String
ZNAC = Hex(PIC_POINT)
D3S.Rd3s = Mid(ZNAC, 1, 2)
D3S.Gd3s = Mid(ZNAC, 3, 2)
D3S.Bd3s = Mid(ZNAC, 5, 2)
If D3S.Rd3s = "" Then D3S.Rd3s = 0
If D3S.Gd3s = "" Then D3S.Gd3s = 0
If D3S.Bd3s = "" Then D3S.Bd3s = 0
HEX_TO_10R = CLng("&H" & D3S.Rd3s)
HEX_TO_10G = CLng("&H" & D3S.Gd3s)
HEX_TO_10B = CLng("&H" & D3S.Bd3s)
STR_RGB = HEX_TO_10R & "," & HEX_TO_10G & "," & HEX_TO_10B
POINT_TO_RGB = STR_RGB
End Function
FELIX-RUS
Copyright 2000-2004 Сообщество Чайников
Контактная информация