How to solve the problem that the clistctrl control updates the flashes of items and displays the large data size at a time

Source: Internet
Author: User

The program needs to regularly retrieve data from an activity table in the database, and display the list on the update interface. For example, if there are 20 data records (changed), the 20 Data

Constantly changing (implemented through other programs)

Solution (1): First search in the list, and then insert

For example, each record has a unique number. When querying, first check whether the number of records exists in the list.

After the item is found, the data of each column is directly updated, as shown in figure

Lvfindinfo lv;
LV. Flags = lvfi_string;
LV. psz = "keyword ";
Int nitem = m_list.finditem (& LV,-1 );

If item> 0, data is directly updated. Use setitemtext (nitem, 0, "value 1 "),....

If item <0, insert an item, insertitem (), and then setitemtext (nitem, 0, "");...

Solution 2:

Before each query, delete all the current records and insert them into the list box in sequence.

//////////////////////////////////////// //////////////////////////////////////// /// // Other methods

// Method 1: Disable repainting

Setwindowredraw (hwnd, false );
... Add the items...
Setwindowredraw (hwnd, true );

Method 2: Use the locking window to disable refresh.

M_list.lockwindowupdate ()

M_list.setitemtext ()
// After modification
M_list.unlockwindowupdate ()

Method 3: Use the virtual list technology.

Each time, data is first put into an array, and then updated based on the displayed amount. Lvn_getdispinfo message required

That is, (ongetdispinfolist (nmhdr * pnmhdr, lresult * presult) function,

Method 4: Use the memory buffer technology

The virtual table can solve the problem. If the data is still updated in a large amount of flashes, You need to modify the ondraw function. memdc can be used to implement the non-blinking solution.

Method 5: Reload the onerasebkgnd (CDC * PDC) Function

Reload the onerasebkgnd (CDC * PDC) function to make the customer area white in the background. If not, calculate the size of the data area when inserting data, if the data area covers the entire customer area, no background is set. In the past, we did not see flashes when we updated dozens of pieces of data in 1 s.

 

 

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.