把EDIT1.TEXT:='1234'分为三个字段, 控件名称 componentName, 控件属性 property, 控件属性值 value,
procedure TForm1.Button3Click(Sender: TObject);
var
ComponentName : string;
strProperty : string;
strValue : String;
PropInfo : PPropInfo;
StrProp : String;
procedure SetComponentValue;
var
i : Integer;
begin
for I:=0 to Self.ComponentCount - 1 do
begin
if Components.Name = ComponentName then
begin
PropInfo := GetPropInfo(Components.classinfo, Strproperty);
if (PropInfo <> nil) and (PropInfo.Name = strProperty) then
begin
SetPropValue(Components,strProperty, strValue);
end;
end;
end;
end;
begin
with query1 do
begin
while not eof do
begin
ComponentName := fieldbyName('componentName').AsStirng;
strProperty := fieldbyName('property').AsStirng
strValue := fieldbyName('value').AsStirng
SetComponentValue;
next;
end;
end;