windows工具栏的渐变背景色的有关问题

windows工具栏的渐变背景色的问题

我把滑动控件(TrackBar)放入了工具栏里面.
只是背景色跟其它的不匹配.



如图:

上面二个都有渐变背景色. 从左往右颜色逐渐变深 .
最下面的是个带菜单的对话框. 它的菜单整个的颜色都相同.

怎么让滑动控件像其它控件一样,支持工具栏里的渐变色?

------解决方案--------------------
楼主,我搞掂了
C/C++ code

HBRUSH CMyTrackBar::CtlColor(CDC* pDC, UINT nCtlColor) 
{
  CRect rect;
  CWnd* pParent = GetParent();
  pParent->GetWindowRect(&rect);

  CDC dcMem;
  dcMem.CreateCompatibleDC(pDC);

  CBitmap Bitmap;
  Bitmap.CreateCompatibleBitmap(pDC, rect.Width(), rect.Height());
  CBitmap* BitmapOld = dcMem.SelectObject(&Bitmap);

  CPoint pt(0, 0);
  MapWindowPoints(pParent, &pt, 1);
  pt = dcMem.OffsetWindowOrg(pt.x, pt.y);
  pParent->SendMessage(WM_ERASEBKGND, (WPARAM)dcMem.m_hDC, 0L);
  dcMem.SetWindowOrg(pt.x, pt.y);
  dcMem.SelectObject(BitmapOld);
  
  static HBRUSH hBrush;
  if (hBrush)
    ::DeleteObject((HGDIOBJ)hBrush);
  hBrush = ::CreatePatternBrush((HBITMAP)Bitmap);
  Bitmap.DeleteObject();
  return hBrush;
}