小编use*_*424的帖子

如何使用delphi 2010 rtti设置数组长度

如何在运行时设置数组长度?setLength(t.GetProperty( 'Propertys'),3); ????

 unit Unit3;

    interface

    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;

    type

    TSubProperty = Class
      private
        Fitem2: Integer;
        Fitem1: String;
        procedure Setitem1(const Value: String);
        procedure Setitem2(const Value: Integer);
      published
      property item1:String read Fitem1 write Setitem1;
      property item2:Integer read Fitem2 write Setitem2;
    End;

    TArraySubPropertys=array of TSubProperty;

    TmyObject = Class
      private
        FPropertys: TArraySubPropertys;
        procedure SetPropertys(const Value: TArraySubPropertys);
      published
      property Propertys:TArraySubPropertys read FPropertys write SetPropertys;
    End;


      TForm3 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private …
Run Code Online (Sandbox Code Playgroud)

delphi rtti delphi-2010

4
推荐指数
1
解决办法
2244
查看次数

标签 统计

delphi ×1

delphi-2010 ×1

rtti ×1