zoukankan      html  css  js  c++  java
  • Rtti.TRttiType (Delphi)

    https://docwiki.embarcadero.com/RADStudio/Sydney/en/Attributes_(RTTI)

    Rtti.TRttiType (Delphi)

    procedure TForm1.FormCreate(Sender: TObject);
    var
      LContext: TRttiContext;
      LType: TRttiType;
      LMethod: TRttiMethod;
      LProperty: TRttiProperty;
      LField: TRttiField;
      LTreeNode1, LTreeNode2: TTreeNode;
    begin
      LContext := TRttiContext.Create;
      try
        LType := LContext.GetType(TButton);
        LTreeNode1 := TreeView1.Items.AddChild(nil, LType.ToString);
    
        LTreeNode2 := TreeView1.Items.AddChild(LTreeNode1, 'Methods');
        for LMethod in LType.GetMethods do
        begin
          TreeView1.Items.AddChild(LTreeNode2, LMethod.ToString);
        end;
    
        LTreeNode2 := TreeView1.Items.AddChild(LTreeNode1, 'Properties');
        for LProperty in LType.GetProperties do
        begin
          TreeView1.Items.AddChild(LTreeNode2, LProperty.ToString);
        end;
    
        LTreeNode2 := TreeView1.Items.AddChild(LTreeNode1, 'Fields');
        for LField in LType.GetFields do
        begin
          TreeView1.Items.AddChild(LTreeNode2, LField.ToString);
        end;
    
        TreeView1.FullExpand;
      finally
        LContext.Free;
      end;
    end;

    Rtti.TRttiType (Delphi)

     
  • 相关阅读:
    day23
    day22
    day21
    day20
    day19
    day18
    day17
    day16
    day15
    PowerDesigner中NAME和COMMENT的互相转换,需要执行语句
  • 原文地址:https://www.cnblogs.com/xionda/p/15306506.html
Copyright © 2011-2022 走看看