zoukankan      html  css  js  c++  java
  • 无闪烁的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();
                    }

                }

            }

        }
  • 相关阅读:
    ps4 如何导出切片 单个图片
    测试webservice的时候,如果出现这个错误:"The test form is only available for requests from the local machine"
    js jquery 按钮点击后 60秒之后才能点击 60秒倒计时
    有空研究一下 superwebsocket (底层是 supersocket) 用来实现 web聊天什么的
    Vue学习笔记一:初识Vue
    被爬虫了,嘻嘻嘻
    Mybatis-generator自动生成器
    SpringCloud笔记五:Feign
    SpringCloud笔记四:Ribbon
    SpringCloud笔记三:Eureka服务注册与发现
  • 原文地址:https://www.cnblogs.com/cl1024cl/p/6204980.html
Copyright © 2011-2022 走看看