VB.NET用双缓冲解决listview闪烁问题
添加一个类,第二个效果更好,然后修改 Form1.Designer.vb
如果修改程序集名称的话,先F5调试程序,然后就可以打开Form1窗口了。
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
Public Class DoubleBufferListView Inherits System.Windows.Forms.ListView Public Sub DoubleBufferListView() SetStyle(ControlStyles.OptimizedDoubleBuffer Or ControlStyles.AllPaintingInWmPaint, True) SetStyle(ControlStyles.EnableNotifyMessage, True) End Sub Protected Overrides Sub OnNotifyMessage(ByVal m As Message) If (m.Msg <> &H14) Then MyBase.OnNotifyMessage(m) End If End Sub End Class
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
Public Class DoubleBufferListView Inherits System.Windows.Forms.ListView Public Sub New() MyBase.New() DoubleBuffered = True End Sub End Class