动画按钮

AniButton.jpg 这个类是一个简单的所有者绘制CButton类,它允许你在按钮中播放动画文件(AVI的)。这个类可以像任何其他所有者绘制控件一样使用——只需包含头文件,并将按钮控件声明为CAniButton而不是CButton 类有以下方法: 隐藏,复制Code

BOOL Open( LPCTSTR lpszFileName );    // Open an AVI file using its filename
BOOL Open( UINT nID );              // Open an AVI file using its resource ID
void Play();                        // Start playing the animation 
void Stop();                        // Stop the animation
void Close();                       // Close the animation and free resources

要设置播放动画的按钮,首先通过手动编辑.rc文件,将AVI添加到您的资源中,并添加以下内容: 隐藏,复制Code

IDR_AVI1  AVI     DISCARDABLE     "res\Animation.avi"

在动画。avi是/res目录下的一个avi文件(记得在resource.h文件中定义IDR_AVI1)。然后,在创建控件(或在对话框OnInitDialog函数中)之后,添加以下内容 隐藏,复制Code

m_Button.Open(IDR_AVI1);
m_Button.Play();

m_Button是你的动画按钮。 本文转载于:http://www.diyabc.com/frontweb/news445.html

原文地址:https://www.cnblogs.com/Dincat/p/13450105.html