Image图片动画制作

 
int isOdd; 
void __fastcall TForm1::FormCreate(TObject *Sender)
{
   Image2->Visible=False; 
   Image3->Visible=False;
   Image2->AutoSize=True;
   Image3->AutoSize=True;
   Timer1->Interval = 0;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Timer1Timer(TObject *Sender)
{
   if (isOdd % 2 == 1) 
   {
      Image1 ->Picture= Image2->Picture;
      isOdd++;
   }
   else
   {
     Image1->Picture = Image3->Picture;
     isOdd--;
   }
 //  Image1->Left = Image1->Left - 10;
   if(Image1->Left <= -Image1->Width)
     Image1->Left = Width;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
   Timer1->Interval = 150; 
   isOdd = 1;
}
//---------------------------------------------------------------------------




附件列表

     

    posted @ 2012-06-28 21:02  XE2011  阅读(225)  评论(0编辑  收藏  举报