比如我的窗口上有TEDIT TBUTTON TPANEL等等
我可能每个的命名都不规则我想找到所有的 并分类处理比如
IF 找到一个控件
BEGIN
判断是EDIT 吗
BEGIN
END;
ESLE 判断是BUTTON吗
BEGIN
END;
.....END
我可能每个的命名都不规则我想找到所有的 并分类处理比如
IF 找到一个控件
BEGIN
判断是EDIT 吗
BEGIN
END;
ESLE 判断是BUTTON吗
BEGIN
END;
.....END
i : integer;
begin
for i := 0 to componentcount - 1 do
begin
if components[i] is TEdit then
(components[i] as TEdit).text := '';
......
end;
end;
begin
if controls[I] is TEdit then
begin
end;
if COntrols[I] is TButton then
begin
end
end
i : integer;
begin
for i := 0 to componentcount - 1 do
begin
if components[i] is TEdit then
TEdit(components[i]).text := '123';
end
else
begin if components[i] is TButton then
TButton(components[i]).Onclick := procedure1;
............
end;
end;
i:integer;
begin
for i := 0 to 窗体.ComponentCount - 1 do
begin
if 窗体.Components[i].ClassType = 窗体类别(如TButton/TEdit) then
begin
你自己的代码
end;
....
end;
end;