Delphi不是VB,这个特性做不到。只能自己写程序:
type
TComponentArray = array [0..100] of TComponent;var
a: TComponentArray;a[0] := label1;
a[1] := edit1;
....
type
TComponentArray = array [0..100] of TComponent;var
a: TComponentArray;a[0] := label1;
a[1] := edit1;
....
begin
setlength(Buttons, 10)
for i:=1 to 10 do
begin
Buttons[i-1] := Tbutton.Create(Form1);
Buttons[i-1].Name := 'Button_' + IntToStr(i);
Buttons[i-1].Caption := '....';
.
.
.
end
TComponent.FindComponent();var
vCompoent: TComponent;
begin
vComponent := FindComponent('Edit1');
if vComponent is TEdit then
TEdit(vComponent).Text := '找的就是你!';
end;
a[1] := edit1;
....好象(我爱洁洁) 说的不可以吧
必须是同类的才行吧,不过我没测试过
用
for i=0 to this.components.count-1
begin
if Components[i] is TEdit then end;
呢?