wir hatten die Funktion HEXStr2Color() zur Umwandlung eines Strings in einen TColor Wert in Verwendung uznter
VCL.
Unter FMX hat diese Funktion nicht mehr gespielt, ich bin aktuell bei dieser neuen Implementierung gelandet.
Warum hat meine
VCL Variante nicht mehr unter FMX gespielt ?
Delphi-Quellcode:
function HEXStr2Color(value:
String): TColor;
var
rec: TAlphaColorRec;
begin
if length(value) <> 7
then
value := '
$FF0000';
/// VCL
result := StrToInt('
$' + value[2] + value[3]) + StrToInt('
$' + value[4] + value[5])
shl 8 + StrToInt('
$' + value[6] + value[7])
shl 16;
/// FMX
with rec
do
begin
A := StrToInt('
$01');
R := StrToInt('
$' + value[2] + value[3]);
G := StrToInt('
$' + value[4] + value[5]);
B :=StrToInt('
$' + value[6] + value[7])
end;
Result := rec.Color;
end;