问题:
我从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;