我定义一个变量temp:Tcheckbox;
然后有:
if Tcomponent(sender).ClassType=Tcheckbox then
begin
temp:=tcomponent(sender);
temp.Checked:=true;
end;
引用
但出现如下错误[Error] client_main.pas(399): Incompatible types: 'TCheckBox' and 'TComponent'
我该如何办?这里是不是有引用问题。
然后有:
if Tcomponent(sender).ClassType=Tcheckbox then
begin
temp:=tcomponent(sender);
temp.Checked:=true;
end;
引用
但出现如下错误[Error] client_main.pas(399): Incompatible types: 'TCheckBox' and 'TComponent'
我该如何办?这里是不是有引用问题。
if Tcomponent(sender).ClassType=Tcheckbox then
begin
temp:=sender as tcheckbox;
temp.Checked:=true;
end;
另: 没试过不知行不行
i:integer;
begin
for i:=0 to form1.ComponentCount-1 do
begin
if form1.Components[i] is TCheckbox then
begin
//deal with
end;
end;
end;