Click here to Skip to main content
16,005,339 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: System's Color Palette Pin
Michael Dunn30-Jan-04 18:02
sitebuilderMichael Dunn30-Jan-04 18:02 
GeneralRe: System's Color Palette Pin
netx20033-Feb-04 3:41
netx20033-Feb-04 3:41 
QuestionApp-specific last used folder? Pin
Ravi Bhavnani30-Jan-04 12:11
professionalRavi Bhavnani30-Jan-04 12:11 
AnswerRe: App-specific last used folder? Pin
Gary R. Wheeler30-Jan-04 14:06
Gary R. Wheeler30-Jan-04 14:06 
QuestionSendkeys in MFC? Pin
Dev57830-Jan-04 12:00
Dev57830-Jan-04 12:00 
AnswerRe: Sendkeys in MFC? Pin
Ravi Bhavnani30-Jan-04 12:07
professionalRavi Bhavnani30-Jan-04 12:07 
AnswerRe: Sendkeys in MFC? Pin
andreir2330-Jan-04 14:26
andreir2330-Jan-04 14:26 
GeneralNeed help with CTabCtrl DrawItem Pin
RobJones30-Jan-04 8:07
RobJones30-Jan-04 8:07 
Hello,
I am trying to draw tab text a different color if the tab receives a TCM_HIGHLIGHTITEM message.. I have created my CTabCtrlEx class and did a override for DrawItem.. My tab control is coloring selected item text blue and none selected items default (black) now I want to catch the TCM_HIGHLIGHTITEM message and color that text red... Here's what I have so far (the problem is that the red doesn't work)

void CTabCtrlEx::DrawItem(LPDRAWITEMSTRUCT lpDIS)
{
	TC_ITEM     tci;
	CDC* pDC = CDC::FromHandle(lpDIS->hDC);
	HIMAGELIST hilTabs = (HIMAGELIST)TabCtrl_GetImageList(GetSafeHwnd());

	BOOL bSelected = (lpDIS->itemID == (UINT)GetCurSel());
	
	CRect rItem(lpDIS->rcItem);

	if (bSelected)
		rItem.bottom -= 1;
	else
		rItem.bottom += 2;
	
	// Fill the tab with default color
	pDC->FillSolidRect(rItem, ::GetSysColor(COLOR_3DFACE));
 
	// 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());
 
	if((lpDIS->itemState & ODS_SELECTED) && (lpDIS->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)))
		pDC->SetTextColor(RGB(0,0,255));
	else if(lpDIS->itemState & TCIS_HIGHLIGHTED)
		pDC->SetTextColor(RGB(255,0,0));
 
	pDC->DrawText(sTemp, rItem, DT_NOPREFIX | DT_CENTER);
}


Any ideas?

Whoever said nothing's impossible never tried slamming a revolving door!
GeneralFigured it out.. Pin
RobJones30-Jan-04 10:04
RobJones30-Jan-04 10:04 
GeneralAnimation of Text and Graphics Pin
ansontong30-Jan-04 7:14
ansontong30-Jan-04 7:14 
GeneralRe: Animation of Text and Graphics Pin
basementman30-Jan-04 9:29
basementman30-Jan-04 9:29 
GeneralVS.Net 2003 Addin and VS.Net 2002 Pin
Anonymous30-Jan-04 6:56
Anonymous30-Jan-04 6:56 
Generalhelp for INA Grid Control Pin
skpanda30-Jan-04 5:25
skpanda30-Jan-04 5:25 
Generalenumerating domain names & computers in each domain Pin
skpanda30-Jan-04 5:22
skpanda30-Jan-04 5:22 
GeneralRe: enumerating domain names & computers in each domain Pin
valikac30-Jan-04 6:16
valikac30-Jan-04 6:16 
GeneralRe: enumerating domain names & computers in each domain Pin
skpanda3-Feb-04 3:43
skpanda3-Feb-04 3:43 
GeneralAccessing XML data in the IWebBrowser2 object Pin
MistER-j30-Jan-04 5:14
MistER-j30-Jan-04 5:14 
GeneralRe: Creating a window on top of IWebBrowser2 control Pin
Neville Franks31-Jan-04 1:15
Neville Franks31-Jan-04 1:15 
GeneralPrint from a .dll Pin
nathanreynolds30-Jan-04 5:03
nathanreynolds30-Jan-04 5:03 
GeneralRe: Print from a .dll Pin
basementman30-Jan-04 9:47
basementman30-Jan-04 9:47 
Generalmulti threaded COM woes Pin
Jim Crafton30-Jan-04 4:36
Jim Crafton30-Jan-04 4:36 
GeneralRe: multi threaded COM woes Pin
Diddy1-Feb-04 22:49
Diddy1-Feb-04 22:49 
GeneralPreventing Memory Leaks Pin
BrockVnm30-Jan-04 4:20
BrockVnm30-Jan-04 4:20 
GeneralRe: Preventing Memory Leaks Pin
John M. Drescher30-Jan-04 4:42
John M. Drescher30-Jan-04 4:42 
GeneralRe: Preventing Memory Leaks Pin
BrockVnm30-Jan-04 4:49
BrockVnm30-Jan-04 4:49 

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.