Click here to Skip to main content
15,917,177 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMFC Listctrl perfomance problem [modified] Pin
Jerin John11-Jul-06 8:04
Jerin John11-Jul-06 8:04 
AnswerRe: MFC Listctrl perfomance problem Pin
Chris Losinger11-Jul-06 10:29
professionalChris Losinger11-Jul-06 10:29 
AnswerRe: MFC Listctrl perfomance problem Pin
RChin11-Jul-06 10:30
RChin11-Jul-06 10:30 
QuestionCListCtrl Performance Pin
prabhudurai11-Jul-06 7:33
prabhudurai11-Jul-06 7:33 
AnswerRe: CListCtrl Performance Pin
David Crow11-Jul-06 7:59
David Crow11-Jul-06 7:59 
QuestionRe: CListCtrl Performance Pin
led mike11-Jul-06 9:24
led mike11-Jul-06 9:24 
AnswerRe: CListCtrl Performance Pin
David Crow11-Jul-06 10:23
David Crow11-Jul-06 10:23 
GeneralRe: CListCtrl Performance Pin
led mike11-Jul-06 19:04
led mike11-Jul-06 19:04 
We may not be talking about the same thing. Here is what I tested with no handling of LVN_GETDISPINFO.

I have CMyListCtrl derived from CListCtrl and set the owner draw style and override DrawItem(). If you don't override DrawItem an Assert is thrown from CListCtrl::DrawItem() if Owner draw style is set.

Then I drop a CListCtrl onto a dialog and add a "control" member variable mapped to the ID of the List Control. Then I change the declaration of the member in the dialog class:

//CListCtrl _list;
CMyListCtrl _list;


Then in the dialog OnInitDialog override I use InsertItem which I believe sends LVM_INSERTITEM message:

_list.InsertColumn(0, _T("Col One"));
_list.InsertColumn(1, _T("Col Two"));

_list.SetColumnWidth(0, 150);
_list.SetColumnWidth(1, 150);

CString sbuf;
for(int n=0; n<100; n++)
{
	sbuf.Format(_T("Item %d"), n+1);
	_list.InsertItem(n, sbuf);
	sbuf.Format(_T("Item %d - 2"), n+1);
	_list.SetItemText(n, 1, sbuf);
}


Notice there are two columns in the list but in my owner draw override I only draw the first one:

void CMyListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	CDC* pDC = CDC::FromHandle( lpDrawItemStruct->hDC);
	CString sbuf = GetItemText( lpDrawItemStruct->itemID, 0);
	pDC->DrawText( sbuf, &lpDrawItemStruct->rcItem, DT_LEFT);
}


As expected the control displays only the first column of all 100 items. If I turn off the Owner Draw Style both columns draw as expected since the control is then drawing.

"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
Colin Angus Mackay in the C# forum


led mike
GeneralRe: CListCtrl Performance Pin
David Crow12-Jul-06 4:26
David Crow12-Jul-06 4:26 
GeneralRe: CListCtrl Performance [modified] Pin
led mike12-Jul-06 4:35
led mike12-Jul-06 4:35 
GeneralRe: CListCtrl Performance Pin
David Crow12-Jul-06 4:38
David Crow12-Jul-06 4:38 
QuestionHow to output html of url into a RichTextBox in visual c++ 6 Pin
method00711-Jul-06 6:54
method00711-Jul-06 6:54 
AnswerRe: How to output html of url into a RichTextBox in visual c++ 6 Pin
led mike11-Jul-06 6:57
led mike11-Jul-06 6:57 
QuestionRe: How to output html of url into a RichTextBox in visual c++ 6 Pin
David Crow11-Jul-06 6:58
David Crow11-Jul-06 6:58 
AnswerRe: How to output html of url into a RichTextBox in visual c++ 6 [modified] Pin
method00711-Jul-06 7:18
method00711-Jul-06 7:18 
QuestionRe: How to output html of url into a RichTextBox in visual c++ 6 Pin
David Crow11-Jul-06 7:53
David Crow11-Jul-06 7:53 
AnswerRe: How to output html of url into a RichTextBox in visual c++ 6 Pin
method00711-Jul-06 8:38
method00711-Jul-06 8:38 
GeneralRe: How to output html of url into a RichTextBox in visual c++ 6 Pin
David Crow11-Jul-06 9:04
David Crow11-Jul-06 9:04 
GeneralRe: How to output html of url into a RichTextBox in visual c++ 6 Pin
method00711-Jul-06 9:38
method00711-Jul-06 9:38 
GeneralRe: How to output html of url into a RichTextBox in visual c++ 6 Pin
David Crow11-Jul-06 10:07
David Crow11-Jul-06 10:07 
GeneralRe: How to output html of url into a RichTextBox in visual c++ 6 Pin
method00711-Jul-06 10:08
method00711-Jul-06 10:08 
GeneralRe: How to output html of url into a RichTextBox in visual c++ 6 Pin
David Crow11-Jul-06 10:30
David Crow11-Jul-06 10:30 
GeneralRe: How to output html of url into a RichTextBox in visual c++ 6 Pin
Maximilien11-Jul-06 7:55
Maximilien11-Jul-06 7:55 
GeneralRe: How to output html of url into a RichTextBox in visual c++ 6 Pin
method00711-Jul-06 9:36
method00711-Jul-06 9:36 
QuestionCan't Detect Tab Control Events Pin
BuckBrown11-Jul-06 6:46
BuckBrown11-Jul-06 6:46 

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.