Microsoft KB Archive/149342

= PRB: CListCtrl Inserting Items Slow If in Icon Modes =

Article ID: 149342

Article Last Modified on 11/21/2006

-

APPLIES TO

 Microsoft Foundation Class Library 4.2, when used with:  Microsoft Visual C++ 2.1

 Microsoft Visual C++ 2.2

 Microsoft Visual C++ 4.0 Standard Edition

 Microsoft Visual C++ 4.1 Subscription</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q149342

<div class="symptoms_section">

SYMPTOMS
Inserting a large number of items into a CListCtrl simultaneously may take a long time if the control is in the LVS_ICON or LVS_SMALLICON modes.

<div class="resolution_section">

RESOLUTION
Before starting to insert the items, disable painting of the control and re-enable the painting when the insertions are done. For more information see the "Sample Code" section of this article.

<div class="status_section">

STATUS
This behavior is by design.

<div class="moreinformation_section">

MORE INFORMATION
A CListCtrl can display its contents in one of four styles: LVS_ICON, LVS_SMALLICON, LVS_LIST, or LVS_REPORT. The problem does not show up if the control is in the LVS_LIST or the LVS_REPORT modes.

Sample Code
//.....

m_List.SetRedraw(FALSE); // turn drawing off regardless of list mode

//.... //Insert the items //....

m_List.SetRedraw(TRUE); // turn drawing back on and update the window m_List.Invalidate; m_List.UpdateWindow;

Additional query words: 2.10 2.20 3.10 3.20 4.00 4.10 CListCtrl adding inserting

Keywords: kbcode kbicon kblistview kbprb kbuidesign KB149342

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.