//设置相应属性值
procedure SetPropertyValue (AComponent: TComponent; sProperty, sValue: string);
var
PropInfo: PPropInfo;
AStrings: TStringList;
begin
if AComponent <> nil then
begin
PropInfo := GetPropInfo(AComponent, sProperty);
if PropInfo <> nil then
begin
case PropInfo.PropType^.Kind of
tkString, tkLString: //字符串属性
SetStrProp(AComponent, PropInfo, sValue);
tkInteger: //序数属性
SetOrdProp(AComponent, PropInfo, StrToInt(sValue));
else if PropInfo.PropType^.Name = 'TStrings' then //列表属性
begin
AStrings := TStringList.Create;
try
Split (sValue, '||', AStrings);
SetOrdProp (AComponent, PropInfo, Integer (AStrings));
finally
AStrings.Free;
end; // end try
end; // end if PropInfo.PropType^.Name = 'TStrings'
end; // end case
end; // end if PropInfo <> nil
end; // end if AComponent <> ni
end;
------------
我也找到了,多谢