home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 March / Chip_1998-03_cd.bin / zkuste / matemat / Vyssi / MATHCTRL.ZIP / DEMO / UNIT1.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1997-10-07  |  991 b   |  53 lines

  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, MathCtrl, Menus;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     MathGrid1: TMathGrid;
  12.     MainMenu1: TMainMenu;
  13.     File1: TMenuItem;
  14.     Run1: TMenuItem;
  15.     Exit1: TMenuItem;
  16.     MathCurve1: TMathCurve;
  17.     procedure Exit1Click(Sender: TObject);
  18.     procedure Run1Click(Sender: TObject);
  19.   private
  20.     { Private declarations }
  21.   public
  22.     { Public declarations }
  23.   end;
  24.  
  25. var
  26.   Form1: TForm1;
  27.  
  28. implementation
  29.  
  30. {$R *.DFM}
  31.  
  32. procedure TForm1.Exit1Click(Sender: TObject);
  33. begin
  34.   Close;
  35. end;
  36.  
  37. procedure TForm1.Run1Click(Sender: TObject);
  38. var
  39.   t, h_t: Extended;
  40. begin
  41.   MathCurve1.Reset;
  42.   t := MathGrid1.MinX;
  43.   h_t := MathGrid1.SizeX / MathGrid1.MapSize.X;
  44.   while t <= MathGrid1.MaxX do
  45.   begin
  46.     MathGrid1.PutPixel(t, 0.5*(sin(10*t)+1) , clBlue);
  47.     MathCurve1.PutPixel(t, 0.5*(cos(10*t)+1));
  48.     t := t + h_t;
  49.   end;
  50. end;
  51.  
  52. end.
  53.