按名称设置属性值

OZ8*_*8HP 7 delphi properties rtti

在Delphi类中,我有一些属性,我想通过名称访问它们来设置它们.现在我使用egSettings.AllowSysop := True;

我想做点什么 Settings('AllowSysop').Value := True;

这样做的原因是,当设置我的用户可以访问的内容时,从许可文件中读取这些文件,其中从文件读取的行(它类似于INI加密)可能看起来像

AllowSysop = True
Run Code Online (Sandbox Code Playgroud)

我知道这是一些必须要制作的RTTI外观代码,但我无法弄明白.

如果可能的话,我认为这对我来说会更容易一些.

希望解释是有道理的

bum*_*mmi 15

implementation
uses TypInfo;
{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
   if IsPublishedProp (Button1, 'Visible') then
    begin
      SetPropValue (Button1, 'Visible',false);
    end;

end;
Run Code Online (Sandbox Code Playgroud)