Click here to Skip to main content
15,916,042 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Insert new row in CListCtrl: need to improve the speed Pin
SandipG 15-Jun-08 19:55
SandipG 15-Jun-08 19:55 
AnswerRe: Insert new row in CListCtrl: need to improve the speed Pin
Nibu babu thomas12-Jun-08 23:50
Nibu babu thomas12-Jun-08 23:50 
GeneralRe: Insert new row in CListCtrl: need to improve the speed Pin
tataxin13-Jun-08 2:21
tataxin13-Jun-08 2:21 
GeneralRe: Insert new row in CListCtrl: need to improve the speed Pin
Nibu babu thomas13-Jun-08 2:25
Nibu babu thomas13-Jun-08 2:25 
NewsRe: Insert new row in CListCtrl: need to improve the speed Pin
tataxin13-Jun-08 2:48
tataxin13-Jun-08 2:48 
AnswerRe: Insert new row in CListCtrl: need to improve the speed Pin
Jijo.Raj13-Jun-08 6:38
Jijo.Raj13-Jun-08 6:38 
GeneralRe: Insert new row in CListCtrl: need to improve the speed Pin
tataxin13-Jun-08 8:07
tataxin13-Jun-08 8:07 
AnswerRe: Insert new row in CListCtrl: need to improve the speed Pin
tataxin16-Jun-08 15:41
tataxin16-Jun-08 15:41 
hi all,
I found a solution, just use the custom draw, do not use a SetRowColor() method. So I just insert new row at top, like this
    CArray crRows;
CArray newData;
int nNew = newData.GetCount();
for (int i=0; i<nnew;>        // insert new row at top
    CString txt = newData.GetAt(i);
    myList.InsertItem(0, txt);

    // get color, depends on the real data
    COLORREF aColor = GetRowColor(txt);
    crRows.InsertAt(0, aColor)

    // change the rest of list ctrl
}


and then, in custom draw of the list control, I implement like this:
void CExample1Dlg::OnNMCustomdrawList2(NMHDR *pNMHDR, LRESULT *pResult) 
{
        NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<nmlvcustomdraw*>( pNMHDR );
	
	int nItem = static_cast<int> (pLVCD->nmcd.dwItemSpec);
	
	pLVCD->clrTextBk = RGB(0, 0, 0); // select background color

	*pResult = CDRF_DODEFAULT;

	// First thing - check the draw stage. If it's the control's prepaint

	// stage, then tell Windows we want messages for every item.


	if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
	{
		*pResult = CDRF_NOTIFYITEMDRAW;
	}
	else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
	{
		// This is the prepaint stage for an item. Here's where we set the

		// item's text color. Our return value will tell Windows to draw the

		// item itself, but it will use the new color we set here.

		// We'll cycle the colors through red, green, and light blue.


		COLORREF aColor = crText.GetAt(nItem);		
		pLVCD->clrText = aColor;
		
		*pResult = CDRF_DODEFAULT;
	}	
}
</int>


that's all, and it doesn't take any time to change the color (time is almost 0)

Thank you everyone Smile | :)
QuestionModal dialog box in a Thread Pin
iayd12-Jun-08 22:22
iayd12-Jun-08 22:22 
AnswerRe: Modal dialog box in a Thread Pin
SandipG 12-Jun-08 23:27
SandipG 12-Jun-08 23:27 
AnswerRe: Modal dialog box in a Thread Pin
Maximilien13-Jun-08 0:40
Maximilien13-Jun-08 0:40 
GeneralRe: Modal dialog box in a Thread Pin
iayd13-Jun-08 1:11
iayd13-Jun-08 1:11 
QuestionWebBrowser control Pin
lunaroverlord12-Jun-08 22:07
lunaroverlord12-Jun-08 22:07 
AnswerRe: WebBrowser control Pin
KarstenK12-Jun-08 22:24
mveKarstenK12-Jun-08 22:24 
GeneralRe: WebBrowser control Pin
lunaroverlord12-Jun-08 22:50
lunaroverlord12-Jun-08 22:50 
QuestionCreating Resource only DLL and using it in code Pin
Anand Todkar12-Jun-08 21:27
Anand Todkar12-Jun-08 21:27 
AnswerRe: Creating Resource only DLL and using it in code Pin
SandipG 12-Jun-08 21:31
SandipG 12-Jun-08 21:31 
GeneralRe: Creating Resource only DLL and using it in code Pin
Nelek12-Jun-08 22:02
protectorNelek12-Jun-08 22:02 
GeneralRe: Creating Resource only DLL and using it in code Pin
SandipG 12-Jun-08 22:05
SandipG 12-Jun-08 22:05 
GeneralRe: Creating Resource only DLL and using it in code Pin
Sudhan Gandhi12-Jun-08 22:47
Sudhan Gandhi12-Jun-08 22:47 
GeneralRe: Creating Resource only DLL and using it in code Pin
Anand Todkar12-Jun-08 22:44
Anand Todkar12-Jun-08 22:44 
QuestionDebug mode VS Release mode Pin
nisha0000012-Jun-08 21:14
nisha0000012-Jun-08 21:14 
QuestionRe: Debug mode VS Release mode Pin
CPallini12-Jun-08 21:25
mveCPallini12-Jun-08 21:25 
GeneralRe: Debug mode VS Release mode Pin
buntyrolln16-Jun-08 18:08
buntyrolln16-Jun-08 18:08 
QuestionRe: Debug mode VS Release mode Pin
CPallini16-Jun-08 21:12
mveCPallini16-Jun-08 21:12 

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.