5,930
社区成员
发帖
与我相关
我的任务
分享
var
i: Integer;
frmComponent: TComponent;
//z: string;
zz: string; //再次定义一下
begin //确定
zz := '';//初始化一下,免得出编译提示
with GroupBox1 do
begin
for i := 0 to ControlCount - 1 do
begin
if Controls[i] is TCheckBox then
if TCheckBox(Controls[i]).Checked then
zz := zz + ',' + TCheckBox(Controls[i]).Caption;
end;
end;
Dialogs.ShowMessage(zz);
end
if Tcheckbox(form1.Components[i-1]).checked then
begin
z:=Tcheckbox(form1.Components[i-1]).caption;
showmessage(z);
end;
var
i:integer;
begin
for i:=1 to form1.ComponentCount do
begin
if form1.Components[i-1] is Tcheckbox then
begin
if Tcheckbox(form1.Components[i-1]).checked then
showmessage(Tcheckbox(form1.Components[i-1]).caption);
end;
end;
end;