Click here to Skip to main content
16,006,594 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: my homework-amicable numbers Pin
David Crow9-Mar-07 3:10
David Crow9-Mar-07 3:10 
AnswerRe: my homework-amicable numbers Pin
sugaragga12-Mar-07 23:39
sugaragga12-Mar-07 23:39 
QuestionMSHFlexGrid not getting displayed when run on non vc++ 7.0 platform. Pin
praveen kumar agarwal9-Mar-07 0:14
praveen kumar agarwal9-Mar-07 0:14 
AnswerRe: MSHFlexGrid not getting displayed when run on non vc++ 7.0 platform. Pin
KaЯl9-Mar-07 3:53
KaЯl9-Mar-07 3:53 
Questionchange tab text color Pin
jeepoo9-Mar-07 0:04
jeepoo9-Mar-07 0:04 
AnswerRe: change tab text color Pin
vimarsh puneet9-Mar-07 0:35
vimarsh puneet9-Mar-07 0:35 
GeneralRe: change tab text color Pin
prathuraj9-Mar-07 0:49
prathuraj9-Mar-07 0:49 
GeneralRe: change tab text color Pin
vimarsh puneet11-Mar-07 20:12
vimarsh puneet11-Mar-07 20:12 
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);
}
Questionhow to highlight a Selected text in the editor Pin
SakthiSurya8-Mar-07 23:51
SakthiSurya8-Mar-07 23:51 
AnswerRe: how to highlight a Selected text in the editor Pin
Hamid_RT9-Mar-07 1:11
Hamid_RT9-Mar-07 1:11 
QuestionRe: how to highlight a Selected text in the editor Pin
David Crow9-Mar-07 3:12
David Crow9-Mar-07 3:12 
AnswerRe: how to highlight a Selected text in the editor Pin
Joan M9-Mar-07 7:09
professionalJoan M9-Mar-07 7:09 
QuestionAdd item in the list at last. Pin
amitmistry_petlad 8-Mar-07 23:26
amitmistry_petlad 8-Mar-07 23:26 
AnswerRe: Add item in the list at last. Pin
prasad_som8-Mar-07 23:31
prasad_som8-Mar-07 23:31 
GeneralRe: Add item in the list at last. Pin
amitmistry_petlad 9-Mar-07 0:10
amitmistry_petlad 9-Mar-07 0:10 
AnswerRe: Add item in the list at last. Pin
_AnsHUMAN_ 8-Mar-07 23:39
_AnsHUMAN_ 8-Mar-07 23:39 
QuestionRe: Add item in the list at last. Pin
David Crow9-Mar-07 3:13
David Crow9-Mar-07 3:13 
AnswerRe: Add item in the list at last. Pin
vibindia9-Mar-07 3:48
vibindia9-Mar-07 3:48 
Joke[Message Deleted] Pin
Enter the Dragon8-Mar-07 23:22
Enter the Dragon8-Mar-07 23:22 
GeneralRe: vIJJI Pin
_AnsHUMAN_ 8-Mar-07 23:24
_AnsHUMAN_ 8-Mar-07 23:24 
GeneralRe: vIJJI Pin
Rajesh R Subramanian8-Mar-07 23:30
professionalRajesh R Subramanian8-Mar-07 23:30 
GeneralRe: vIJJI Pin
toxcct9-Mar-07 1:06
toxcct9-Mar-07 1:06 
GeneralRe: vIJJI Pin
Rajesh R Subramanian9-Mar-07 1:11
professionalRajesh R Subramanian9-Mar-07 1:11 
GeneralRe: vIJJI Pin
Wes Aday9-Mar-07 4:15
professionalWes Aday9-Mar-07 4:15 
GeneralRe: vIJJI Pin
Rajesh R Subramanian9-Mar-07 4:19
professionalRajesh R Subramanian9-Mar-07 4:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.