网页色值转Rbg值
Public Function hextorgb(hexcolor As String)
input format = #FFCC00
Dim r, g, b As Byte
r = CByte("&H" & Mid(hexcolor, 2, 2))
g = CByte("&H" & Mid(hexcolor, 4, 2))
b = CByte("&H" & Mid(hexcolor, 6, 2))
hextorgb = r & "," & g & "," & b
End Function
Function hextorgb(hexcolor: String): String
var
r,g,b: Byte;
begin
r := StrToInt($+MidStr(hexcolor,2,2));
g := StrToInt($+MidStr(hexcolor,4,2));
b := StrToInt($+MidStr(hexcolor,6,2));
result := IntToStr(r)+,+IntToStr(g)+,+IntToStr(b);
end;
Delphi的色值用4字节整型量存贮,表示形式#00RRGGBB,直接写一个相应的函数就可以.