for i:=0 to form1.ComponentCount-1 do begin if form1.Components[i] is TBUtton then TButton(form1.Components[i]).Caption := 'OK'; end; //遍历窗体上的button,使他们的caption为……或者 var arr : array[0..5] of TButton begin for i:=0 to 5 do begin arr[i] := TButton.Create(Self); arr[i].Parent := Self; arr[i].left := i+10; .... end; //动态创建按钮数组; end;
for i:=1 to **.count ---- ???ControlCount吧 ---- 这里还要增加一个按件类型识别判断 if tedit(sender).*** ---- 使用Tag值
for I := 0 to ComponentCount - 1 do if Components[I] is TButton then TButton(Components[I]).Caption := 'Hello';
if form1.Components[i] is TBUtton
then TButton(form1.Components[i]).Caption := 'OK';
end; //遍历窗体上的button,使他们的caption为……或者
var arr : array[0..5] of TButton
begin
for i:=0 to 5 do begin
arr[i] := TButton.Create(Self);
arr[i].Parent := Self;
arr[i].left := i+10;
....
end; //动态创建按钮数组;
end;
---- 这里还要增加一个按件类型识别判断
if tedit(sender).*** ---- 使用Tag值
if Components[I] is TButton then
TButton(Components[I]).Caption := 'Hello';