1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
void CXTabCtrl::SetTabText(int iIndex, CString lpszCaption){
// stocke le nouveau libellé dans une map
m_tabsLabel[iIndex] = lpszCaption;
CRect rect;
GetItemRect(iIndex, &rect);
if (GetCurSel() == iIndex){
rect.top -= ::GetSystemMetrics(SM_CYEDGE);
rect.bottom += ::GetSystemMetrics(SM_CYEDGE);
rect.left -= ::GetSystemMetrics(SM_CYEDGE);
rect.right += ::GetSystemMetrics(SM_CYEDGE);
} else{
rect.left += ::GetSystemMetrics(SM_CYEDGE);
rect.bottom -= ::GetSystemMetrics(SM_CYEDGE);
rect.right -= ::GetSystemMetrics(SM_CYEDGE);
}
CDC * pDC = GetDC();
CFont font;
font.CreateFont(-11,
0,
0,
0,
FW_NORMAL,
FALSE, FALSE, FALSE,
ANSI_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_ROMAN,
"MS Sans Serif");
CFont *pFont = pDC->SelectObject(&font);
LPDRAWITEMSTRUCT lp = new DRAWITEMSTRUCT;
lp->itemID = iIndex;
lp->hDC = pDC->GetSafeHdc(); //->m_hDC;
lp->rcItem=rect;
DrawItem(lp);
} |
Partager