以前的一段代码,处理窗体中的所有Panel for i := 0 to (Self.ControlCount - 1) do begin if (Self.Controls[i].ClassName='TPanel') and (TPanel(Self.Controls[i]).Visible=true) then begin ... ... end; end;
yangfan369(扬帆远行)的代码里再加个计数器 var ContorlCount:integer; . . contorlcount:=0; for i := 0 to (Self.ControlCount - 1) do begin if (Self.Controls[i].ClassName='TPanel') and (TPanel(Self.Controls[i]).Visible=true) then begin inc(contorlcount); end; end;
if (Self.Controls[n].ClassName='TCheckbox') and (tcheckbox(Self.Controls[n]).Checked =true) then begin m:=m+1 ; end; 这一句: if (Self.Controls[n].ClassName='TCheckbox') and (tcheckbox(Self.Controls[n]).Checked =true) then 为什么总是假?下面的语句: begin m:=m+1 ; end; 总是无法执行到呢?!:(
for i := 0 to (Self.ControlCount - 1) do
begin
if (Self.Controls[i].ClassName='TPanel') and (TPanel(Self.Controls[i]).Visible=true) then
begin
... ...
end;
end;
var
ContorlCount:integer;
.
.
contorlcount:=0;
for i := 0 to (Self.ControlCount - 1) do
begin
if (Self.Controls[i].ClassName='TPanel') and (TPanel(Self.Controls[i]).Visible=true) then
begin
inc(contorlcount);
end;
end;
if (Self.Controls[n].ClassName='TCheckbox') and (tcheckbox(Self.Controls[n]).Checked =true) then
begin
m:=m+1 ;
end;
这一句:
if (Self.Controls[n].ClassName='TCheckbox') and (tcheckbox(Self.Controls[n]).Checked =true) then
为什么总是假?下面的语句:
begin
m:=m+1 ;
end;
总是无法执行到呢?!:(
form1.ComponentCount