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();
                    }

                }

            }

        }
  • 相关阅读:
    压缩信息立方体和集合技术内幕
    C++Dll Injection Tutorial
    BW BW项目的对象传输
    SDSD知识点列表
    MM提取MM模块配置的抛帐科目列表
    MMCollect some Transaction Key Problem
    BW数据装在的处理链的设计顺序
    asp.net 页面回车触发button按钮事件
    (转载)Linux多线程信号量的概念和使用
    (转载)如何查看安装的glibc版本
  • 原文地址:https://www.cnblogs.com/cl1024cl/p/6204980.html
Copyright © 2011-2022 走看看