首页 新闻 会员 周边

高手请进,WinForm中ListView防止闪烁遇到的奇怪问题

0
悬赏园豆:10 [待解决问题]

问题:
我从ListView派生一个类,加了防止闪烁代码,效果很好,但是在View.Details显示模式下,滚动条不会自动绘制出
来,在其他显示模式下不存在问题,请问该怎么解决?

 

如下图,滚动条不会自己刷新,每次该出现滚动条时,该位置都不会自动画出来,把鼠标移上去才会显示出来:

public class MyListView : ListView
    {
        protected override CreateParams CreateParams
        {
            get
            {
                // Removes all the flickering of repainting node's
                CreateParams cp = base.CreateParams;
                cp.ExStyle |= 0x02000000; // WS_CLIPCHILDREN
                return cp;
            }
        }
    }

------------------------下面是调用代码-----------------------------

            // 
            // myListView1
            // 
            this.myListView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
            this.myListView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            this.columnHeader1,
            this.columnHeader2,
            this.columnHeader3});
            this.myListView1.FullRowSelect = true;
            this.myListView1.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
            listViewItem1,
            listViewItem2,
            listViewItem3,
            listViewItem4,
            listViewItem5,
            listViewItem6});
            this.myListView1.Location = new System.Drawing.Point(60, 46);
            this.myListView1.Name = "myListView1";
            this.myListView1.Size = new System.Drawing.Size(615, 104);
            this.myListView1.TabIndex = 22;
            this.myListView1.UseCompatibleStateImageBehavior = false;
            this.myListView1.View = System.Windows.Forms.View.Details;
CQVIE的主页 CQVIE | 初学一级 | 园豆:194
提问于:2015-12-08 16:37
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册