全部文本 #18843 原始 编辑

Untitled

公开 text v1 · 不可变
·已发布 2005-07-30 09:25 UTC
渲染后的文本正文
a form, memo, 3 buttons

button1 is save, button 2 is load, button 3 add lines to memo

type
 TForm1
 //.... other TForm1 declarations
 public
  x : integer;
 end;


procedure TForm1.OnCreate(blabla);
begin
 x := 0;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
 if (not SaveDialog1.Execute()) then exit;
 memo1.Lines.SaveToFile(savedialog1.FileName); 
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
 memo1.Lines.Add(inttostr(x));
 inc(x);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
 if (not opendialog1.Execute()) then exit;
 memo1.Lines.LoadFromFile(opendialog1.FileName);
end;