Want to chnage the color of tab button in TabCtrl when clicked
I am trying to change the only the tab button of a tab control when
clicked(not the entire background color ).
I was succesfull in changing the background color of a tabcontrol.
Now I want to change only the tab color to orange when its clicked.
I need to handle this in onEraseBkgnd,but could not.
Pls advise.
BOOL CMyTabctrl::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
if(m_tabPages[m_tabCurrent]->GetFocus())
{
CBrush backBrush(RGB(54, 21, 21)); //orange
// Save old brush.
CBrush* pOldBrush = pDC->SelectObject(&backBrush);
CRect rect;
pDC->GetClipBox(&rect); // Erase the area needed.
pDC->PatBlt(rect.left, rect.top, rect.Width(),
rect.Height(), PATCOPY);
pDC->SelectObject(pOldBrush);
pDC->SetTextColor(RGB(255,255,255));
}else{
CBrush backBrush(RGB(96, 96, 96));
// Save old brush.
CBrush* pOldBrush = pDC->SelectObject(&backBrush);
CRect rect;
pDC->GetClipBox(&rect); // Erase the area needed.
pDC->PatBlt(rect.left, rect.top, rect.Width(),
rect.Height(), PATCOPY);
pDC->SelectObject(pOldBrush);
pDC->SetTextColor(RGB(255,255,255));
}
return TRUE;
}