Article ID: 179907 - Last Review: July 11, 2005 - Revision: 1.2 How To Display CAnimateCtrl with Transparent Background
This article was previously published under Q179907 On This PageSUMMARY
This article shows how to display .avi files with a transparent background.
The CAnimateCtrl control supports .avi files with a transparent background
with a limitation of 16 colors. The first pixel in the first frame of an
.avi file determines the background color of the CAnimateCtrl control.
MORE INFORMATION
To display an .avi file on CDialog or its derived classes, you need to set
the style of CAnimateCtrl to ACM_TRANSPARENT. If the color of the first
pixel in the first frame of an .avi file is different from the background
color of the CDialog object, then the background color of the CDialog
object is used as the background color of the .avi file. Thus, the
CAminateCtrl control will have a transparent background.
To display an .avi file on CView or its derived classes, you must intercept the WM_CTLCOLOR message in the CView class and return a null brush (not to be confused with just returning NULL) for the CAnimateCtrl. In addition, you must set the style of CAnimateCtrl to ACM_TRANSPARENT. Otherwise, the default dialog box background color will be used as the background color for the animation control. For example, if a CView derived class is CTestanimctrlView, you need to add the ACM_TRANSPARENT style to the CAnimateCtrl, add ON_WM_CTLCOLOR into the message map, and add an OnCtlColor message handler into the CTestanimctrlView class as described in the following steps: Sample CodeAdd the following code into the .h file of CTestanimctrlView:
APPLIES TO
| Other Resources Other Support Sites
CommunityArticle Translations |





















Back to the top