複製鏈接
請複製以下鏈接發送給好友

Animation控件

鎖定
Animation控件允許你創建顯示動畫的按鈕,如點擊一個按鈕播放一個.avi文件。該控件只能播放沒有聲音的.avi文件,並且Animation控件只能播放解壓縮的或使用RLE(行程長度編碼,Run-Length Encoding)壓縮的.avi文件。
中文名
Animation控件
作    用
允許你創建顯示動畫的按鈕
格    式
壓縮的.avi文件
屬    性
AutoPlay屬性

目錄

Animation控件説明

如果試圖加載包含聲音的.avi文件或該控件不支持的格式,將返回一個錯誤(錯誤碼35752)。該控件的一個例子是Windows 95中的文件拷貝過程。該過程在拷貝時使用了一個Animation控件,顯示了一個文件從一個文件夾飛入另一個文件夾。

Animation控件屬性

AutoPlay屬性,BackStyle屬性(Animation控件),Center屬性,Height,Width屬性,TableIndex屬性,DragIcon屬性,DragMode屬性,hWnd屬性,TabStop屬性,HelpContextID屬性,Name屬性,Parent屬性,Container屬性,ToolTipText屬性,WhatsThisHelpID屬性,OLEDropMode屬性(ActiveX控件),Height,Width屬性(ActiveX控件),Index屬性(ActiveX控件),Left,Top屬性(ActiveX控件),Tag屬性(ActiveX控件),Visible屬性(ActiveX控件),Object屬性(ActiveX控件),BackColor,ForeColor屬性(ActiveX控件),Enabled屬性(ActiveX控件),hWnd屬性(ActiveX控件)。

Animation控件方法

Close方法(Animation控件),Open方法(Animation控件),Play方法,Stop方法(Animation控件),SetFocus方法,Drag方法,Move方法,ZOrder方法,ShowWhatsThis方法,OLEDrag方法(ActiveX控件)。

Animation控件事件

DragDrop事件,DragOver事件,GotFocus事件,LostFocus事件,MouseDown事件,MouseUp事件,MouseMove事件,Validate事件,OLECompleteDrag事件(ActiveX控件),OLEDragDrop事件(ActiveX控件),OLEDragOver事件(ActiveX控件),OLEGiveFeedBack事件(ActiveX控件),OLESetData事件(ActiveX控件),OLEStartDrag事件(ActiveX控件),Click事件(ActiveX控件),DblClick事件(ActiveX控件)。

Animation控件例子

#define WM_STOPCLIP WM_USER+1
#define WM_PLAYCLIP WM_USER+2
#define WM_SHOWFIRSTFRAME WM_USER+3
#define WM_SHOWLASTFRAME WM_USER+4
UINT MyClipThreadProc( LPVOID pParam )
{
// NOTE: pParentWnd is the parent window of the animation control.
CWnd* pParentWnd = (CWnd*) pParam;
CAnimateCtrl cAnimCtrl;
// Create the animation control.
if (!cAnimCtrl.Create(WS_CHILD|WS_VISIBLE|ACS_CENTER,
CRect(10,10,100,100), pParentWnd, 1))
return false;
// Open the AVI file.
if (!cAnimCtrl.Open(_T("myavi.avi")))
return false;
// Pump message from the queue until the stop play message is received.
MSG msg;
while (GetMessage(&msg, NULL, 0, 0) && (msg.message != WM_STOPCLIP))
{
switch (msg.message)
{
// Start playing from the first frame to the last,
// continuously repeating.
case WM_PLAYCLIP:
if (!cAnimCtrl.Play(0, -1, -1))
return false;
break;
// Show the first frame.
case WM_SHOWFIRSTFRAME:
if (!cAnimCtrl.Seek(0))
return false;
cAnimCtrl.RedrawWindow();
break;
// Show the last frame.
case WM_SHOWLASTFRAME:
if (!cAnimCtrl.Seek(-1))
return false;
cAnimCtrl.RedrawWindow();
break;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
cAnimCtrl.Stop();
cAnimCtrl.Close();
return true;
}
摘自MSDN