home *** CD-ROM | disk | FTP | other *** search
- unit th2DGraph_Demo1;
-
- interface
-
- uses
- SysUtils, Types, Classes, Variants, QTypes, QGraphics, QControls, QForms,
- QDialogs, QStdCtrls, QExtCtrls, Qth2DGraph;
-
- type
- TForm1 = class(TForm)
- th: Tth2DGraph;
- Timer1: TTimer;
- procedure Timer1Timer(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
- pha: Integer;
- amp: Extended;
-
- implementation
-
- {$R *.xfm}
-
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- amp := 0;
- pha := 0;
- end;
-
- procedure TForm1.Timer1Timer(Sender: TObject);
- var n: Integer;
- begin
- th.Freeze(True);
- th.Clear;
-
- pha := (pha + 5) mod 360;
- amp := 10 * sin(Pi*pha/180);
-
- th.LayerOption := True;
- th.LayerOptions(1, pmLine, 1);
- th.LayerOptions(2, pmBar, 1);
- th.LayerOptions(3, pmDot, 5);
-
- for n:=0 to 36 do begin
- th.AddXY(10*n, amp*sin(Pi*10*n/180), clOlive, 1);
- th.AddXY(10*n, amp*sin(Pi*10*n/180), clHighlight, 2);
- th.AddXY(10*n, amp*sin(Pi*10*n/180), clMaroon, 3);
- end;
-
- th.Freeze(False);
- end;
-
- end.
-