表格的话stringgrid蛮不错的,不过只是显示看,而且设计期要能看到,我觉的label都行,呵呵,下面是我写的小示例,可以保存,也可以读取。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Label1: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
aStream: TStream;
begin
Label1.Caption:= '1 2 3 4 5'+#$A#$D
+'6 7 8 9 10';
aStream:= TMemoryStream.Create;
aStream.WriteComponent(Label1);
TMemoryStream(aStream).SaveToFile('a.txt');
aStream.Free;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
aStream: TStream;
begin
aStream:= TMemoryStream.Create;
TMemoryStream(aStream).LoadFromFile('a.txt');
aStream.ReadComponent(Label1);
aStream.Free;
end;
end.