I would like to assign some color to label (TNewStaticText - property Color: TColor; read write;) on my form.
I have my color stored as '$RRGGBB' (String) and I would like to convert it to TColor using Delphi function StringToColor() but Inno Setup shows me an error if I use this function in script. How to tell Inno Setup to use this function or how to convert String to TColor in Inno to use it with this property?
正如安德烈亚斯在对这个问题的评论中提到的那样,没有内置功能.你可以自己制作,例如:
function StringToRGB(ColorStr: string): Integer;
var
r, g, b: Integer;
begin
r := StrToInt(Copy(ColorStr, 1, 3));
g := StrToInt('$' + Copy(ColorStr, 4, 2));
b := StrToInt('$' + Copy(ColorStr, 6, 2));
Result := (r or (g shl 8) or (b shl 16));
end;
Run Code Online (Sandbox Code Playgroud)
如果你一直存储你的颜色$BBGGRR,你可以简单地转换它
StrToInt(ColorStr);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2066 次 |
| 最近记录: |