• 无闪烁的listview


     Q:http://topic.csdn.net/u/20071205/15/116fa433-69bc-418d-a31c-3c279abc8007.html

    A:

    public   partial   class  Form1 : Form
        
    {
            
            
    class    DoubleBufferListView   :   ListView 
            

                    
    public    DoubleBufferListView() 
                    

                            SetStyle(ControlStyles.DoubleBuffer
    | ControlStyles.OptimizedDoubleBuffer  |   ControlStyles.AllPaintingInWmPaint,    true ); 
                            UpdateStyles(); 
                    }
     
            }
     


            
    public  Form1()
            
    {
                InitializeComponent();
            }


            DoubleBufferListView lv 
    =   new  DoubleBufferListView();
            
    private   void  Form1_Load( object  sender, EventArgs e)
            
    {
               
                
    this .Controls.Add(lv);
                lv.Height 
    =   300 ;
                lv.Width 
    =   300 ;
                
    new  System.Threading.Thread( new  System.Threading.ParameterizedThreadStart(doAdd)).Start();
            }


             
            
    void  doAdd( object  obj)
            
    {
                
    if  ( this .InvokeRequired)
                
    {
                    
    this .Invoke( new  System.Action < object > (doAdd),  new   object []  { obj } );
                }

                
    else
                
    {
                    
    for  ( int  i  =   0 ; i  <   100 ; i ++ )
                    
    {
                        
    this .lv.Items.Add( new  ListViewItem( " jinjazz "   +   this .lv.Items.Count.ToString()));
                        System.Threading.Thread.Sleep(
    10 );
                        Application.DoEvents();
                    }

                }

            }

        }
  • 相关阅读:
    罗马数字转整数,Java执行时间超过100%用户的写法
    Vue生产环境调试的方法
    pdf翻译并转html
    {"$ref":"$.data.jobTaskList[0]"}
    More than one row with the given identifier was found
    去掉告警信息,去除告警信息
    Initialized JPA EntityManagerFactory for persistence unit 'default'
    获取当前包名、获取包名、
    nginx丢失头部信息
    SQL Error: 1526, SQLState: HY000,Table has no partition for value 738625
  • 原文地址:https://www.cnblogs.com/cl1024cl/p/6204980.html
Copyright © 2020-2023  润新知