Transparent CAnimateCtrl on CDialog
Ian White -- ianw@mfltd.co.uk Sunday, January 12, 1997 Environment: NT4.0 Win95 VC4.2b Hi, I have a Dialog box with a Custom WM_PAINT. I draw a Dib on the = background. I want to play an AVI Using CAnimateCtrl, but have the background show = through the AVI. These seems to be possible using ACS_TRANSPARENT as a flag in the CAnimateCtrl Create, but this is not working. I still get the = grey dialog box background as a square behind the AVI. The code to create and show the AVI Follows: anyhelp would be appreciated. ********************************* CMyDialog::OnInitDialog() CAnimateCtrl *MyAnimate=3Dnew CAnimateCtrl; rect.top=3D190; rect.left=3D20; rect.right=3D320; rect.bottom=3D260; MyAnimate->Create(ACS_CENTER | ACS_TRANSPARENT |ACS_AUTOPLAY | WS_CHILD = | WS_VISIBLE,rect,this,10005); MyAnimate->Open("d:\\ani.avi"); ************************************ My OnPaint Does the following : ***************************** CPaintDC dc(this); v_lpbfh =3D (LPBITMAPFILEHEADER)v_lpBitmap; v_lpbih =3D (LPBITMAPINFOHEADER)(v_lpBitmap + sizeof(BITMAPFILEHEADER)); // draw our bitmap. DrawDibDraw( v_hddBkgnd, dc, dc.m_ps.rcPaint.left, dc.m_ps.rcPaint.top, dc.m_ps.rcPaint.right, dc.m_ps.rcPaint.bottom, v_lpbih, v_lpBits, dc.m_ps.rcPaint.left, dc.m_ps.rcPaint.top, dc.m_ps.rcPaint.right, dc.m_ps.rcPaint.bottom, 0);=20 Thanks a lot Ian Ian -- Ian White, Generic Setup Dev. Email: ianw@mfltd.co.uk Ext: 5309
Bing Hou -- hou@tfn.com Tuesday, January 14, 1997 Ian, The ACS_TRANSPARENT style draws the animation control using the dialog's background color instead of the clip's background color. That's why you saw the grey sqaure in the background. It doesn't take into account the background you put there manually. You may try to subclass the animation control and handle WM_ERASEBKGND message, where you draw the background one more time for the control. Good luck. Bing Hou hou@tfn.com ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "Man is still the most extraordinary computer of all." -JFK ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ______________________________ Reply Separator _________________________________ Subject: Transparent CAnimateCtrl on CDialog Author: Ian Whiteat Internet Date: 1/12/97 11:03 PM Environment: NT4.0 Win95 VC4.2b Hi, I have a Dialog box with a Custom WM_PAINT. I draw a Dib on the = background. I want to play an AVI Using CAnimateCtrl, but have the background show = through the AVI. These seems to be possible using ACS_TRANSPARENT as a flag in the CAnimateCtrl Create, but this is not working. I still get the = grey dialog box background as a square behind the AVI. The code to create and show the AVI Follows: anyhelp would be appreciated. ********************************* CMyDialog::OnInitDialog() CAnimateCtrl *MyAnimate=3Dnew CAnimateCtrl; rect.top=3D190; rect.left=3D20; rect.right=3D320; rect.bottom=3D260; MyAnimate->Create(ACS_CENTER | ACS_TRANSPARENT |ACS_AUTOPLAY | WS_CHILD = | WS_VISIBLE,rect,this,10005); MyAnimate->Open("d:\\ani.avi"); ************************************ My OnPaint Does the following : ***************************** CPaintDC dc(this); v_lpbfh =3D (LPBITMAPFILEHEADER)v_lpBitmap; v_lpbih =3D (LPBITMAPINFOHEADER)(v_lpBitmap + sizeof(BITMAPFILEHEADER)); // draw our bitmap. DrawDibDraw( v_hddBkgnd, dc, dc.m_ps.rcPaint.left, dc.m_ps.rcPaint.top, dc.m_ps.rcPaint.right, dc.m_ps.rcPaint.bottom, v_lpbih, v_lpBits, dc.m_ps.rcPaint.left, dc.m_ps.rcPaint.top, dc.m_ps.rcPaint.right, dc.m_ps.rcPaint.bottom, 0);=20 Thanks a lot Ian Ian -- Ian White, Generic Setup Dev. Email: ianw@mfltd.co.uk Ext: 5309
Joao Marcos Melo Mendes -- jmmm@megamedia.pt Wednesday, January 15, 1997 Hello, Ian, On Sun, 12 Jan 1997, Ian White wrote: > Environment: NT4.0 Win95 VC4.2b > > Hi, I have a Dialog box with a Custom WM_PAINT. I draw a Dib on the = > background. > > I want to play an AVI Using CAnimateCtrl, but have the background show = > through the AVI. > These seems to be possible using ACS_TRANSPARENT as a flag > in the CAnimateCtrl Create, but this is not working. I still get the = > grey > dialog box background as a square behind the AVI. This may or may not be what you're looking for, but have you tried intercepting the WM_ERASEBKGND message on your CAnimateCtrl? Try something along these lines: BOOL CMyAnimateCtrl::OnEraseBkgnd(CDC* pDC) { return FALSE; } Hope this helps...:) Joao Mendes MegaMedia, S.A. "We're fools to make war on our brothers in arms." - Mark Knopfler -----BEGIN PGP PUBLIC KEY BLOCK----- Version: 2.6.2 mQBNAzKu3TgAAAECAL8+YSEFZ0XrlBMu9t2xDq3rhpWZoscP83VrX5MevAm3UOd6 fOtDKsJxsWugnVMexo50NfBjeWOHz5nA1b9hYx0ABRG0H0pvYW8gTWVuZGVzIDxq bW1tQG1lZ2FtZWRpYS5wdD4= =sspP -----END PGP PUBLIC KEY BLOCK-----
| Вернуться в корень Архива |