Click here to Skip to main content
15,914,066 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: about SetWindowText() and change window default style Pin
Anonymous18-May-04 7:37
Anonymous18-May-04 7:37 
GeneralRe: about SetWindowText() and change window default style Pin
David Crow18-May-04 7:41
David Crow18-May-04 7:41 
GeneralRe: about SetWindowText() and change window default style Pin
vividtang18-May-04 8:35
vividtang18-May-04 8:35 
Generalicon blending Pin
alex.barylski18-May-04 6:12
alex.barylski18-May-04 6:12 
GeneralRe: icon blending Pin
Maximilien18-May-04 6:42
Maximilien18-May-04 6:42 
GeneralRe: icon blending Pin
alex.barylski18-May-04 7:28
alex.barylski18-May-04 7:28 
GeneralRe: icon blending Pin
bikram singh18-May-04 10:12
bikram singh18-May-04 10:12 
GeneralCompile error in Visual C++ 7.1 SDK Pin
dagaa18-May-04 5:26
dagaa18-May-04 5:26 
GeneralTemplate Pin
Alexander M.,18-May-04 4:37
Alexander M.,18-May-04 4:37 
GeneralRe: Template Pin
Diddy18-May-04 4:39
Diddy18-May-04 4:39 
GeneralRe: Template Pin
Alexander M.,18-May-04 4:45
Alexander M.,18-May-04 4:45 
GeneralRe: Template Pin
Anonymous18-May-04 6:32
Anonymous18-May-04 6:32 
GeneralRe: Template Pin
Alexander M.,18-May-04 7:46
Alexander M.,18-May-04 7:46 
GeneralISAPI FILTER ON ISA SERVER Pin
SuzannaS18-May-04 4:35
SuzannaS18-May-04 4:35 
GeneralRe: ISAPI FILTER ON ISA SERVER Pin
Mahendra_78619-May-04 21:27
Mahendra_78619-May-04 21:27 
GeneralRe: ISAPI FILTER ON ISA SERVER Pin
SuzannaS20-May-04 21:38
SuzannaS20-May-04 21:38 
Questionhow to set multi color subitem in CListCtrl grid? Pin
george ivanov18-May-04 3:55
george ivanov18-May-04 3:55 
AnswerRe: how to set multi color subitem in CListCtrl grid? Pin
RChin18-May-04 4:13
RChin18-May-04 4:13 
GeneralRe: how to set multi color subitem in CListCtrl grid? Pin
Roger Allen18-May-04 4:34
Roger Allen18-May-04 4:34 
GeneralRe: how to set multi color subitem in CListCtrl grid? Pin
alex.barylski18-May-04 4:37
alex.barylski18-May-04 4:37 
GeneralRe: how to set multi color subitem in CListCtrl grid? Pin
RChin18-May-04 5:25
RChin18-May-04 5:25 
GeneralRe: how to set multi color subitem in CListCtrl grid? Pin
george ivanov18-May-04 8:38
george ivanov18-May-04 8:38 
AnswerRe: how to set multi color subitem in CListCtrl grid? Pin
chris10918-May-04 5:11
chris10918-May-04 5:11 
I suppose your control already has the LVS_REPORT style.
In the window or dialog containing the CListCtrl, add a NM_CUSTOMDRAW notification. Then just code the different colors you wish in the added notification method, like in the following example (for more information, see:
Customizing a Control's Appearance Using Custom Draw, in MSDN
Owner-draw CListCtrl MFC app at http://www.simtel.net/pub/pd/15298.shtml)

void CTestListCtrlDlg::OnNMCustomdrawList1(NMHDR *pNMHDR, LRESULT *pResult)<br />
{<br />
	LPNMLVCUSTOMDRAW pNMCD = reinterpret_cast<LPNMLVCUSTOMDRAW>(pNMHDR);<br />
<br />
	*pResult = 0;	<br />
<br />
	// If this is the beginning of the control's paint cycle, request<br />
    // notifications for each item.<br />
	switch(pNMCD->nmcd.dwDrawStage)<br />
	{<br />
	case CDDS_PREPAINT:<br />
		*pResult = CDRF_NOTIFYITEMDRAW;<br />
		break;<br />
<br />
	case CDDS_ITEMPREPAINT:<br />
		// This is the prepaint stage for an item<br />
<br />
		// Tell Windows to notify sub-items painting<br />
		*pResult = CDRF_NOTIFYSUBITEMDRAW;<br />
		break;<br />
<br />
	case CDDS_SUBITEM | CDDS_ITEMPREPAINT:<br />
		// This is the prepaint stage for a sub-item<br />
		switch(pNMCD->iSubItem) {<br />
		case 0:<br />
			// Item<br />
			switch(pNMCD->nmcd.dwItemSpec) {<br />
			case 0:<br />
				// First item: black text, blue background<br />
				pNMCD->clrText = RGB(0,0,0);<br />
				pNMCD->clrTextBk = RGB(0,255,255);<br />
				break;<br />
			default:<br />
				// Next items: black text, white background<br />
				pNMCD->clrText = RGB(0,0,0);<br />
				pNMCD->clrTextBk = RGB(255,255,255);<br />
				break;<br />
			}<br />
			break;<br />
		case 1:<br />
			// First sub-item: red text, yellow background<br />
			pNMCD->clrText = RGB(255,0,0);<br />
			pNMCD->clrTextBk = RGB(255,255,0);<br />
			break;<br />
		default:<br />
			// Next sub-items: black text, white background<br />
			pNMCD->clrText = RGB(0,0,0);<br />
			pNMCD->clrTextBk = RGB(255,255,255);<br />
			break;<br />
		}<br />
		// Tell Windows to paint the control itself.<br />
		*pResult = CDRF_DODEFAULT;<br />
		break;<br />
<br />
	default:<br />
		// Tell Windows to paint the control itself.<br />
		*pResult = CDRF_DODEFAULT;<br />
		break;<br />
	}<br />
}


Friendly yours, Chris
GeneralRe: how to set multi color subitem in CListCtrl grid? Pin
george ivanov18-May-04 22:44
george ivanov18-May-04 22:44 
AnswerIf you want an EZ-Pass... Pin
Abin18-May-04 7:18
Abin18-May-04 7:18 

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.