I'm having problem with FlowLayoutPanel, i have custom control created with labels on it, looks like row with size: 250:20. I'm adding it to Flowlayoutpanel programmatically. When i Add 200 or 300 rows on FlowLayoutPanel, it seems ok, but when i'm importing text file with say 1000 lines, so it needs to create 1000 rows (mycontrol) to FlowLayoutPanel, it tooks 30 seconds its slow. How to add it faster and also delete faster.
My FlowLayoutPanel is covered with custom code:
Public Sub New()
MyBase.New()
SetStyle(ControlStyles.AllPaintingInWmPaint, True)
SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
SetStyle(ControlStyles.DoubleBuffer, True)
DoubleBuffered = True
UpdateStyles()
End Sub
Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
cp.ExStyle = cp.ExStyle Or &H2000000
Return cp
End Get
End Property
Screenshot Here: My FlowLayoutPanel and custom Control(Row with Labels)
Adding Items code:
For Each item As String In MyList
Dim a As New customControl
Dim col(1) As String
col(0) = item
col(1) = ""
a.lblTxt.Text = item
FlowLayoutPanel.SuspendLayout()
FlowLayoutPanell.Controls.Add(a)
FlowLayoutPanel.ResumeLayout()
Next
Deleting Items Code:
FlowLayoutPanell.Controls.Clear()
I wanted to use ListView, but it has no options like Transparent Color and other stuff to customize, that's why i use FlowLayoutPanel and customControl.