I am facing a issue that ListView becomes extremely laggy when I add many SubItems. For example, when I try to do a horizontal scroll, it takes about 1 second to update/repaint and that is not acceptable.
I want to be able to show small amount of rows (<50), but large amount of columns (>400). Only a few columns will be visible at the time. I also need to be able to set individual back colors to separate cells. Data within my list view will be populated once and not from the database.
I have tried enabling a double buffering and using a virtual mode, but it did not help much, if at all. I have found some 3rd party ListView alternatives, but they either did not work or had many unnecessary features and hence were very expensive to purchase.
Can you suggest how to fix this issue? Here is my sample code:
Code:Private ListView1 As New ListView With {.Size = New Size(300, 400)} Private Sub Form1_Load() Handles Me.Load Const columns = 500 Controls.Add(ListView1) With ListView1 .BeginUpdate() .View = View.Details .HeaderStyle = ColumnHeaderStyle.Nonclickable For c = 1 To columns .Columns.Add(c.ToString, 50, HorizontalAlignment.Center) Next For r = 1 To 20 Dim l As New ListViewItem(r & "1") For c = 2 To columns l.SubItems.Add(r & c) Next .Items.Add(l) Next .EndUpdate() '.DoubleBuffered(True) End With End Sub




Reply With Quote
