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