希望这段对你有用。
uses TypInfo
///get PropList
var
pProps: PPropList;
nTotProps, nProps, I: Integer;
begin
//get the total number of properties
nTotProps := GetTypeData(ClassInfo).PropCount;
//allocate the required memory
GetMem(pProps, sizeof(PPropInfo) * nTotProps);
try
//fill the pProps with a filtered list
nProps := GetPropList(ClassInfo, [tkEnumeration], pProps);
finally
FreeMem(pProps, sizeof(PPropInfo) * nTotProps);
end;
////get prop value sample string property
var
PropInfo: PPropInfo;
PropInfo := GetPropInfo( aTButton.ClassInfo, aTEdit.Text);
if PropInfo <> nil then
if PropInfo^.PropType^.Kind = tkLString then
Caption := GetStrProp(aTButton, PropInfo)
else ShowMessage('Not a string property')
else
showMessage('Property doesn''t exist');