function GetProperty(AControl: TPersistent; AProperty: String): PPropInfo; var i: Integer; props: PPropList; typeData: PTypeData; begin Result := nil; if (AControl = nil) or (AControl.ClassInfo = nil) then Exit; typeData := GetTypeData(AControl.ClassInfo); if (typeData = nil) or (typeData^.PropCount = 0) then Exit; GetMem(props, typeData^.PropCount * SizeOf(Pointer)); try GetPropInfos(AControl.ClassInfo, props); for i := 0to typeData^.PropCount - 1do begin with Props^[i]^ do if (Name = AProperty) then result := Props^[i]; end; finally FreeMem(props); end; end;
procedure TForm1.Button1Click(Sender: TObject); var propInfo: PPropInfo; begin PropInfo := GetProperty(Button1.Font, 'Name'); if PropInfo <> nilthen SetStrProp(Button1.Font, PropInfo, 'Arial'); end; Взято из http://www.lmc-mediaagentur.de/dpool