Animate.cpp
上传用户:lulishicai
上传日期:2010-03-01
资源大小:13202k
文件大小:4k
源码类别:
Delphi/CppBuilder
开发平台:
C++ Builder
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "Animate.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::FormCreate(TObject *Sender)
- {
- Form1->ListBox1->Items->Add("aviNone");
- Form1->ListBox1->Items->Add("aviFindFolder");
- Form1->ListBox1->Items->Add("aviFindFile");
- Form1->ListBox1->Items->Add("aviFindComputer");
- Form1->ListBox1->Items->Add("aviCopyFiles");
- Form1->ListBox1->Items->Add("aviCopyFile");
- Form1->ListBox1->Items->Add("aviRecycleFile");
- Form1->ListBox1->Items->Add("aviEmptyRecycle");
- Form1->ListBox1->Items->Add("aviDeleteFile");
- //为列表框添加列表项
- Form1->Animate1->AutoSize=true;
- //控件会自动适应动画的尺寸
- Form1->Animate1->Transparent=true;
- //不显示背景色
- Form1->Edit1->Text=IntToStr(Form1->Animate1->FrameCount);
- Form1->Edit2->Text="高"+IntToStr(Form1->Animate1->FrameHeight)+"宽"+IntToStr(Form1->Animate1->FrameWidth);
- Form1->Edit3->Text=IntToStr(Form1->Animate1->StartFrame);
- Form1->Edit4->Text=IntToStr(Form1->Animate1->StopFrame);
- Form1->Edit5->Text='0';
- //初始化文本框状态
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Timer1Timer(TObject *Sender)
- {
- Form1->Animate1->Transparent=!Form1->CheckBox1->Checked;
- //设置背景色是否可见
- Form1->Edit1->Text=IntToStr(Form1->Animate1->FrameCount);
- Form1->Edit2->Text="高"+IntToStr(Form1->Animate1->FrameHeight)+"宽"+IntToStr(Form1->Animate1->FrameWidth);
- Form1->Edit3->Text=IntToStr(Form1->Animate1->StartFrame);
- Form1->Edit4->Text=IntToStr(Form1->Animate1->StopFrame);
- //设置文本框中的显示文本
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::CheckBox1Click(TObject *Sender)
- {
- if (Form1->CheckBox1->Checked)
- {
- Form1->Animate1->Transparent=!Form1->Animate1->Transparent;
- Form1->Animate1->Update();
- }
- //设置背景色是否可见
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::ListBox1Click(TObject *Sender)
- {
- int i;
- int j;
- //定义变量
- for (i=0;i<=(ListBox1->Items->Count-1);i++)
- {
- if (ListBox1->Selected[i])
- {
- j=i;
- }
- }
- switch (j)
- {
- case 0:Form1->Animate1->CommonAVI=aviNone;
- break;
- case 1:Form1->Animate1->CommonAVI=aviFindFolder;
- break;
- case 2:Form1->Animate1->CommonAVI=aviFindFile;
- break;
- case 3:Form1->Animate1->CommonAVI=aviFindComputer;
- break;
- case 4:Form1->Animate1->CommonAVI=aviCopyFiles;
- break;
- case 5:Form1->Animate1->CommonAVI=aviCopyFile;
- break;
- case 6:Form1->Animate1->CommonAVI=aviRecycleFile;
- break;
- case 7:Form1->Animate1->CommonAVI=aviEmptyRecycle;
- break;
- case 8:Form1->Animate1->CommonAVI=aviDeleteFile;
- }
- //显示选中的动画
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Edit3Change(TObject *Sender)
- {
- Form1->Animate1->StartFrame=StrToInt(Form1->Edit3->Text);
- //设置动画开始的帧数
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Edit4Change(TObject *Sender)
- {
- Form1->Animate1->StopFrame=StrToInt(Form1->Edit4->Text);
- //设置动画结束的帧数
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Edit5Change(TObject *Sender)
- {
- Form1->Animate1->Seek(StrToInt(Form1->Edit5->Text));
- //跳到指定的帧数
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::ListBox1DblClick(TObject *Sender)
- {
- Form1->Animate1->Active=!Form1->Animate1->Active;
- //开始或停止动画
- }
- //---------------------------------------------------------------------------