How to change the background color of an MFC animation control

I am using an animation control in my MFC dialog box to display an animation. I want to change the background color of this control to match the background color of my dialog box, which is white. I have tried using the OnCtlColor() method, but apparently the animation control does not invoke OnCtlColor().
There is no such thing as "WM_CTLCOLORANIMATION", only 'BTN, 'DLG, 'EDIT, 'LISTBOX, 'SCROLLBAR, and 'STATIC -- so you're out of luck there.

But you can use an AVI files with a transparent background.

Article ID: 179907
How To Display CAnimateCtrl with Transparent Background
http://support.microsoft.com/kb/179907

Might this help?

Andy
Thanks for the reply. And yes that's what the problem exactly is. There isn't anything such as a "WM_CTLCOLORANIMATION". I had tried what the msdn article says with no luck before. But then i tried this and it solved my problem

1
2
3
4
5
6
7
8
9
10
HBRUSH CFinishPage::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
	HBRUSH hbr = __super::OnCtlColor(pDC, pWnd, nCtlColor);

	pDC->SetBkMode(TRANSPARENT);
	pDC->SetBkColor(RGB(255,255,255));
	hbr = (HBRUSH) mWhiteBrush;
	// TODO:  Return a different brush if the default is not desired
	return hbr;
}


This paints the entire background white. In most cases that my not be desirable but works for me.
Topic archived. No new replies allowed.