1 type 2 TForm1 = class(TForm) 3 Button1: TButton; 4 Label1: TLabel; 5 Button2: TButton; 6 procedure Button1Click(Sender: TObject); 7 procedure Button2Click(Sender: TObject); 8 private 9 { Private declarations } 10 public 11 { Public declarations } 12 end; 13 14 WList = record 15 Cone :String; 16 Ctwo :String; 17 end; 18 wMyList = ^WList; 19 20 var 21 Form1: TForm1; 22 23 MyList : TList; 24 25 implementation 26 27 {$R *.dfm} 28 29 procedure TForm1.Button1Click(Sender: TObject); 30 var 31 Rows :wMyList; 32 33 begin 34 MyList := TList.Create; 35 new(Rows); 36 Rows.Cone := '神奇'; 37 Rows.Ctwo := '魔力'; 38 MyList.Add(Pointer(Rows)); 39 end; 40 41 procedure TForm1.Button2Click(Sender: TObject); 42 var 43 Rows :wMyList; 44 begin 45 if MyList = nil then 46 begin 47 exit; 48 end 49 else 50 begin 51 Rows:= wMyList(MyList.Items[0]); 52 Label1.Caption := Rows.Cone + Rows.Ctwo; 53 end; 54 end;
delphi 用起来有点麻烦啊。。