home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 October / CMCD1004.ISO / Software / Freeware / Programare / th2DGraph / Demo / th2DGraph_Demo1.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2004-09-06  |  1.1 KB  |  60 lines

  1. unit th2DGraph_Demo1;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, Types, Classes, Variants, QTypes, QGraphics, QControls, QForms, 
  7.   QDialogs, QStdCtrls, QExtCtrls, Qth2DGraph;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     th: Tth2DGraph;
  12.     Timer1: TTimer;
  13.     procedure Timer1Timer(Sender: TObject);
  14.     procedure FormCreate(Sender: TObject);
  15.   private
  16.     { Private declarations }
  17.   public
  18.     { Public declarations }
  19.   end;
  20.  
  21. var
  22.   Form1: TForm1;
  23.   pha: Integer;
  24.   amp: Extended;
  25.  
  26. implementation
  27.  
  28. {$R *.xfm}
  29.  
  30. procedure TForm1.FormCreate(Sender: TObject);
  31. begin
  32.   amp := 0;
  33.   pha := 0;
  34. end;
  35.  
  36. procedure TForm1.Timer1Timer(Sender: TObject);
  37. var n: Integer;
  38. begin
  39.   th.Freeze(True);
  40.   th.Clear;
  41.  
  42.   pha := (pha + 5) mod 360;
  43.   amp := 10 * sin(Pi*pha/180);
  44.  
  45.   th.LayerOption := True;
  46.   th.LayerOptions(1, pmLine, 1);
  47.   th.LayerOptions(2, pmBar,  1);
  48.   th.LayerOptions(3, pmDot,  5);
  49.  
  50.   for n:=0 to 36 do begin
  51.       th.AddXY(10*n, amp*sin(Pi*10*n/180), clOlive,     1);
  52.       th.AddXY(10*n, amp*sin(Pi*10*n/180), clHighlight, 2);
  53.       th.AddXY(10*n, amp*sin(Pi*10*n/180), clMaroon,    3);
  54.     end;
  55.  
  56.   th.Freeze(False);
  57. end;
  58.  
  59. end.
  60.