function makecheckbox(AParent:TFmxObject; ACount:Integer; Str:string):TFmxObject;
var
i:Integer;
num:TCheckBox;
begin
for I := 1 to ACount do
begin
Application.ProcessMessages;
try
num:=TCheckBox.Create(AParent);
num.Parent:=AParent;
num.Text:=IntToStr(i);
if i<10 then num.Text:='0' + num.Text;
num.FontColor:=TAlphaColorRec.Dimgray;
num.TextSettings.HorzAlign:=TTextAlign(0);
num.OnChange:=Form_main.numChange;
num.StyledSettings:=[];
num.StyleLookup:=Str;
finally
num.Free;
end;
Result:=num;
end;
end;
示例:
makecheckbox(Grid_r,33,'num_red_01Style1');
makecheckbox(Grid_b,16,'num_blue_01Style1');
效果:
var
i:Integer;
num:TCheckBox;
begin
for I := 1 to ACount do
begin
Application.ProcessMessages;
try
num:=TCheckBox.Create(AParent);
num.Parent:=AParent;
num.Text:=IntToStr(i);
if i<10 then num.Text:='0' + num.Text;
num.FontColor:=TAlphaColorRec.Dimgray;
num.TextSettings.HorzAlign:=TTextAlign(0);
num.OnChange:=Form_main.numChange;
num.StyledSettings:=[];
num.StyleLookup:=Str;
finally
num.Free;
end;
Result:=num;
end;
end;
示例:
makecheckbox(Grid_r,33,'num_red_01Style1');
makecheckbox(Grid_b,16,'num_blue_01Style1');
效果: