home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 March / Chip_1999-03_cd.bin / zkuste / delphi / D / MATEM.ARJ / RCHART.ZIP / exmpl-3 / cpp1 / twowind.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-10-15  |  2.4 KB  |  86 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "twowind.h"
  6. #include "rchart.hpp"
  7. #include "math.h"
  8. //---------------------------------------------------------------------------
  9. #pragma link "RChart"
  10. #pragma resource "*.dfm"
  11. TForm1 *Form1;
  12. //---------------------------------------------------------------------------
  13. __fastcall TForm1::TForm1(TComponent* Owner)
  14.     : TForm(Owner)
  15. {
  16. }
  17. //---------------------------------------------------------------------------
  18. void __fastcall TForm1::Button1Click(TObject *Sender)
  19. {
  20. const int MaxJ = 66;
  21.  
  22. int i,j;
  23. int Signi;
  24.  
  25. RChart2->RangeLoX = -3;
  26. RChart2->RangeHiX = 3;
  27. RChart2->RangeLoY = 0;
  28. RChart2->RangeHiY = 110;
  29. Button1->Enabled = false;
  30. Button2->Enabled = true;
  31. Button3->Enabled = false;
  32. j=1;
  33. Signi = 1;
  34. ProgEnd = false;
  35. while (! ProgEnd)
  36.   {
  37.   RChart1->ClearGraf();                              // window 1
  38.   RChart1->MarkAt (sin((j)/9.0),sin((j)/7.0),16);
  39.   RChart1->MoveTo (sin((j)/9.0),sin((j)/7.0));
  40.   for (i=1; i<=25; i++)
  41.     {
  42.     RChart1->DrawTo (sin((i+j)/9.0),sin((i+j)/7.0));
  43.     RChart1->MarkAt (sin((i+j)/9.0),sin((i+j)/7.0),16);
  44.     }
  45.   RChart1->ShowGraf();
  46.  
  47.   RChart2->ClearGraf();                              // window 2
  48.   RChart2->MoveTo (0,0);
  49.   RChart2->DataColor = clBlack;
  50.   for (i=1; i<=50; i++)
  51.     RChart2->DrawTo (exp(i/150.0)*sin(i*j/800.0),i);
  52.   RChart2->DataColor = clWhite;
  53.   for (i=51; i<=100; i++)
  54.     RChart2->DrawTo (exp(i/150.0)*sin(i*j/800.0),i);
  55.   RChart2->ShowGraf();
  56.  
  57.   j = j+Signi;
  58.   if (j > MaxJ)
  59.     Signi = -1;
  60.   if (j < -MaxJ)
  61.     Signi = +1;
  62.   Application->ProcessMessages();
  63.   }
  64. Button2->Enabled = false;
  65. Button1->Enabled = true;
  66. Button3->Enabled = true;
  67. }
  68. //---------------------------------------------------------------------------
  69. void __fastcall TForm1::Button2Click(TObject *Sender)
  70. {
  71. Button2->Enabled = false;
  72. Button1->Enabled = true;
  73. Button3->Enabled = true;
  74. ProgEnd = True;
  75. }
  76. //---------------------------------------------------------------------------
  77. void __fastcall TForm1::Button4Click(TObject *Sender)
  78. {
  79. RChart1->CopyToClipboard();
  80. }
  81. //---------------------------------------------------------------------------
  82. void __fastcall TForm1::Button3Click(TObject *Sender)
  83. {
  84. Close();    
  85. }
  86. //---------------------------------------------------------------------------