1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103:
| unit main;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Values, StdCtrls, ComCtrls, ImgList, ToolWin, ExtCtrls;
type TForm1 = class(TForm) Button1: TButton; Button2: TButton; sdMain: TSaveDialog; Button3: TButton; odMain: TOpenDialog; Memo1: TMemo; Timer1: TTimer; procedure FormCreate(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Timer1Timer(Sender: TObject); private public end;
var Form1: TForm1; v : TResultTable; implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject); begin randomize; v := TResultTable.Create(0,100,1,10); end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction); begin v.Destroy; end;
procedure TForm1.Button1Click(Sender: TObject); var x,y : integer; begin randomize;
for y := 1 to 10 do begin x := -v.Resolution; while x < v.MaxLambda-v.Resolution do begin x := x + v.Resolution; v.AddValue(x,random(5000)/1000) end; end; end;
procedure TForm1.Button2Click(Sender: TObject); var sl : TStringList; x,y : Integer; begin if sdMain.Execute then begin sl := TStringList.Create; for y := 1 to 10 do begin x := -v.Resolution;
while x < v.MaxLambda-v.Resolution do begin x := x + v.Resolution; sl.Add(FloatToStr(v.GetValue(x,y))) end;
end; sl.SaveToFile(sdMain.Filename+'.sfkj'); sl.Destroy; end; end;
procedure TForm1.Button3Click(Sender: TObject); begin if odMain.Execute then begin memo1.Lines.LoadFromFile(odMain.FileName); end; end;
procedure TForm1.Timer1Timer(Sender: TObject); begin Label2.Visible:= true end;
end. |