see this code void CEnTabCtrl::DrawItem(LPDRAWITEMSTRUCT lpdis) { TC_ITEM tci; CDC* pDC = CDC::FromHandle(lpdis->hDC); HIMAGELIST hilTabs = (HIMAGELIST)TabCtrl_GetImageList(GetSafeHwnd()); BOOL bSelected = (lpdis->itemID == (UINT)GetCurSel()); BOOL bColor = (s_dwCustomLook & ETC_COLOR); CRect rItem(lpdis->rcItem); if (bSelected) rItem.bottom -= 1; else rItem.bottom += 2; // tab // blend from back color to COLOR_3DFACE if 16 bit mode or better COLORREF crFrom = GetTabColor(bSelected); if (s_dwCustomLook & ETC_GRADIENT && pDC->GetDeviceCaps(BITSPIXEL) >= 16) { COLORREF crTo = bSelected ? ::GetSysColor(COLOR_3DFACE) : Darker(!bColor || m_crBack == -1 ? ::GetSysColor(COLOR_3DFACE) : m_crBack, 0.7f); int nROrg = GetRValue(crFrom); int nGOrg = GetGValue(crFrom); int nBOrg = GetBValue(crFrom); int nRDiff = GetRValue(crTo) - nROrg; int nGDiff = GetGValue(crTo) - nGOrg; int nBDiff = GetBValue(crTo) - nBOrg; int nHeight = rItem.Height(); for (int nLine = 0; nLine < nHeight; nLine += 2) { int nRed = nROrg + (nLine * nRDiff) / nHeight; int nGreen = nGOrg + (nLine * nGDiff) / nHeight; int nBlue = nBOrg + (nLine * nBDiff) / nHeight; pDC->FillSolidRect(CRect(rItem.left, rItem.top + nLine, rItem.right, rItem.top + nLine + 2), RGB(nRed, nGreen, nBlue)); } } else // simple solid fill pDC->FillSolidRect(rItem, crFrom); // text & icon rItem.left += PADDING; rItem.top += PADDING + (bSelected ? 1 : 0); pDC->SetBkMode(TRANSPARENT); CString sTemp; tci.mask = TCIF_TEXT | TCIF_IMAGE; tci.pszText = sTemp.GetBuffer(100); tci.cchTextMax = 99; GetItem(lpdis->itemID, &tci); sTemp.ReleaseBuffer(); // icon if (hilTabs) { ImageList_Draw(hilTabs, tci.iImage, *pDC, rItem.left, rItem.top, ILD_TRANSPARENT); rItem.left += 16 + PADDING; } // text rItem.right -= PADDING; FormatText(sTemp, pDC, rItem.Width()); COLORREF col; col=RGB(255,0,0); pDC->SetTextColor(col); pDC->DrawText(sTemp, rItem, DT_NOPREFIX | DT_CENTER); }