I understand, I am doing something similar but in my view classes there are no gradient backgrounds, only in my control bars. The only thing I can thing of is to get the parent to paint the background for you. So far I have only done this with custom classes but it may be possible to handle it in a generic way without making custom classes for all your controls.
Heres a little code that may possibly help, it uses GDI+:
void CFlatButton::OnPaint()
{
CPaintDC dc(this);
CRect rClient;
GetClientRect(&rClient);
BOOL bPushed = (GetState() & BST_PUSHED);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
CBitmap bmpMem;
bmpMem.CreateDiscardableBitmap(&dc,
rClient.Width(), rClient.Height());
dcMem.SelectObject(bmpMem);
Graphics gfxMem(dcMem.GetSafeHdc());
if(!m_pBackground)
{
CDC dcBkg;
dcBkg.CreateCompatibleDC(&dc);
CBitmap bmpBkg;
bmpBkg.CreateCompatibleBitmap(&dc, rClient.Width(), rClient.Height());
CBitmap* pOldBmpBkg = (CBitmap*)dcBkg.SelectObject(&bmpBkg);
dcBkg.BitBlt(0, 0, rClient.Width(), rClient.Height(),
&dc, rClient.left, rClient.top, SRCCOPY);
dcBkg.SelectObject(pOldBmpBkg);
m_pBackground = Bitmap::FromHBITMAP((HBITMAP)bmpBkg.GetSafeHandle(), NULL);
}
gfxMem.DrawImage(m_pBackground, 0, 0, rClient.right, rClient.bottom);
.........
or you can have the parent of the control paint it for you:
CRect rParent;
GetWindowRect(&rParent);
GetParent()->ScreenToClient(&rParent);
CClientDC dcParent(GetParent());
CDC dcBkg;
dcBkg.CreateCompatibleDC(&dcParent);
CBitmap bmpBkg;
bmpBkg.CreateCompatibleBitmap(&dcParent,
rClient.Width(), rClient.Height());
CBitmap* pOldBmpBkg = (CBitmap*)dcBkg.SelectObject(&bmpBkg);
dcBkg.BitBlt(0, 0, rClient.Width(), rClient.Height(),
&dcParent, rParent.left, rParent.top, SRCCOPY);
dcBkg.SelectObject(pOldBmpBkg);
m_pBackground = Bitmap::FromHBITMAP((HBITMAP)bmpBkg.GetSafeHandle(), NULL);
I have used both methods in different classes. To handle it at the parent level may be possible, you get a CDC* in the WM_CTLCOLOR message. This is very interesting to me, I wish I had time to try it out right now and let you know.
Good luck