delphi 中判断对象是否具备某一属性

Posted 游子日月长

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了delphi 中判断对象是否具备某一属性相关的知识,希望对你有一定的参考价值。

  Uses   TypInfo;  
   
  {$R   *.dfm}  
   
  procedure   TForm1.Button1Click(Sender:   TObject);  
  var  
      I:   Integer;  
  begin  
      for   I   :=   0   to   ComponentCount   -   1   do  
          if   IsPublishedProp(Components[I],   ‘Caption‘)   then  
              ListBox1.Items.Add(Components[I].Name);  

  end;  

以上是关于delphi 中判断对象是否具备某一属性的主要内容,如果未能解决你的问题,请参考以下文章