TList是一个很好的东东,有了它我们不再去费尽心思地写什么列表类,直接用它就行了,下面的例子示范了怎样建立一个TList并插入两条记录,这些记录将输出在PaintBox上。 C Builder 请参照Delphi的例子 Delphi procedure TForm1.FormButton1Click(Sender: TObject); type PMyList = ^AList; AList = record I: Integer; C: Char; end; var MyList: TList; ARecord: PMyList; B: Byte; Y: Word; begin MyList := TList.Create; New(ARecord); ARecord^.I := 100; ARecord^.C := Z; MyList.Add(ARecord); //加入一个100的整数和Z字符 New(ARecord); ARecord^.I := 200; ARecord^.C := X; MyList.Add(ARecord); //加入一个200的整数和X字符 Y := 10; ! for B := 0 to (MyList.Count - 1) do begin ARecord := MyList.Items[B]; Canvas.TextOut(10, Y, IntToStr(ARecord^.I)); Y := Y 30; Canvas.TextOut(10, Y, ARecord^.C); Y := Y 30; end; for B := 0 to (MyList.Count - 1) do begin ARecord := MyList.Items[B]; Dispose(ARecord); end; MyList.Free; end; . 。 ..