怎样用名字引用对象?
引用组件倒可以用FindComponent
var
Form: TForm
begin
...
...
Form.Caption := Hello
...
...
end;
现在就是用Form去引用真正的对象。
var
V: string;
begin
V := Button2;
if FindComponent(V) is TButton then
TButton(FindComponent(V)).Caption := OK
end;
RTTI
查查吧
同意jacky_shen(jacky)