Dynamic add data without flashing in C # using ListView

Source: Internet
Author: User

First, customize a class listviewnf, inherit from System.Windows.Forms.ListView

1 classListViewNF:System.Windows.Forms.ListView2     {3          Publiclistviewnf ()4         {5             //turn on double buffering6              This. SetStyle (Controlstyles.optimizeddoublebuffer | Controlstyles.allpaintinginwmpaint,true);7 8             //Enable The Onnotifymessage event so we get a chance to filter out9             //Windows messages before they get to the form ' s WndProcTen              This. SetStyle (Controlstyles.enablenotifymessage,true); One         } A  -         protected Override voidonnotifymessage (Message m) -         { the             //Filter out the WM_ERASEBKGND message -             if(M.msg! =0x14) -             { -                 Base. Onnotifymessage (m); +             } -  +         } A  at  -}

Then, modify the location of the ListView in our form code to define the original

System.Windows.Forms.ListView ListView1;

Revision changed to

LISTVIEWNF ListView1;

Https://msdn.microsoft.com/zh-cn/library/system.windows.forms.control.setstyle (vs.80). aspx
Http://www.cnblogs.com/zdkjob/archive/2012/01/17/2324618.html

Dynamic add data without flashing in C # using ListView

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.