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. //---------------------------------------------------------------------------
  10. __fastcall TForm1::TForm1(TComponent* Owner)
  11.         : TForm(Owner)
  12. {
  13.   Icon1=new TIcon();
  14.   Icon1->LoadFromFile("icon1.ico");
  15.   Icon2=new TIcon();
  16.   Icon2->LoadFromFile("icon2.ico");
  17.   Icon3=new TIcon();
  18.   Icon3->LoadFromFile("icon3.ico");
  19.   Icon4=new TIcon();
  20.   Icon4->LoadFromFile("icon4.ico");
  21.   IconNN=0;
  22. }
  23. //---------------------------------------------------------------------------
  24. __fastcall TForm1::~TForm1()
  25. {
  26.   delete Icon1;
  27.   delete Icon2;
  28.   delete Icon3;
  29.   delete Icon4;
  30. }
  31. //---------------------------------------------------------------------------
  32. void __fastcall TForm1::Timer1Timer(TObject *Sender)
  33. {
  34.   if(IconNN==0)
  35.   {
  36.     Icon=Icon1;
  37.     IconNN=1;
  38.   }
  39.   else if(IconNN==1)
  40.   {
  41.     Icon=Icon2;
  42.     IconNN=2;
  43.   }
  44.   else if(IconNN==2)
  45.   {
  46.     Icon=Icon3;
  47.     IconNN=3;
  48.   }
  49.   else if(IconNN==3)
  50.   {
  51.     Icon=Icon4;
  52.     IconNN=0;
  53.   }
  54. }
  55. //---------------------------------------------------------------------------
  56. void __fastcall TForm1::Button1Click(TObject *Sender)
  57. {
  58.  Close();
  59. }
  60. //---------------------------------------------------------------------------