![](https://images.cnblogs.com/cnblogs_com/xe2011/201207/20120716160223827.png)
![](https://images.cnblogs.com/cnblogs_com/xe2011/201207/201207161602235221.png)
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;
}
//---------------------------------------------------------------------------
![](https://images.cnblogs.com/cnblogs_com/xe2011/201207/201207161602246551.jpg)
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;
}
//---------------------------------------------------------------------------
![](https://images.cnblogs.com/cnblogs_com/xe2011/201207/201207161602246551.jpg)