这样是否正确?
if self.componts is Tcheckbox and Tcheckbox(componts[i]).checked then
case Tcheckbox(componts[i]).tag of
0:..........
1:............
2:......
end;
if self.componts is Tcheckbox and Tcheckbox(componts[i]).checked then
case Tcheckbox(componts[i]).tag of
0:..........
1:............
2:......
end;
最好加括号!
var
i : integer;
begin
for i := 0 to Self.ComponentCount - 1 do
begin
if (Self.Components[i] is TCheckBox) and (TCheckBox(Components[i]).Checked) then
//do something here
end;
end;