Unit1.cpp
上传用户:lhxd_sz
上传日期:2014-10-02
资源大小:38814k
文件大小:1k
源码类别:

VC书籍

开发平台:

C++ Builder

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "Unit1.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma resource "*.dfm"
  8. TForm1 *Form1;
  9. int Count;
  10. //---------------------------------------------------------------------------
  11. __fastcall TForm1::TForm1(TComponent* Owner)
  12.         : TForm(Owner)
  13. {
  14.   int ii;
  15.   AnsiString ass;
  16.   Count=1;
  17.   for(ii=0;ii<ControlCount;ii++)
  18.   {
  19.     ass=Controls[ii]->Name;
  20.     if(ass.SubString(1,5)=="Image")
  21.     {
  22.       if(ass!="Image1")
  23.       {
  24.         Controls[ii]->Left=Image1->Left;
  25.         Controls[ii]->Top=Image1->Top;
  26.       }
  27.     }
  28.   }
  29. }
  30. //---------------------------------------------------------------------------
  31. void __fastcall TForm1::Rotate(int count,bool bl)
  32. {
  33.   int ii;
  34.   for(ii=0;ii<ControlCount;ii++)
  35.   {
  36.     if(Controls[ii]->Name=="Image"+IntToStr(count))
  37.     {
  38.       Controls[ii]->Visible=bl;
  39.       break;
  40.     }
  41.   }
  42. }
  43. //---------------------------------------------------------------------------
  44. void __fastcall TForm1::Timer1Timer(TObject *Sender)
  45. {
  46.   Rotate(Count,False);
  47.   Count++;
  48.   if(Count>6)Count=1;
  49.   Rotate(Count,True);
  50. }
  51. //---------------------------------------------------------------------------