Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27199

flowlayoutpanel flickering problem

$
0
0
Hi All,

I have a small issue. Im using a flowlayoutpanel (with background) as a sort of listbox :)

I add another flowlayoutpanel to it as a control then add child labels to it, this gives me a sort of list to work with. It all works great and functions like a listbox the way I imagined. The only issue is when adding or removing the controls the flowlayoutpanel flickers as it repaints itself.

Any way to make this not happen? I looked at suspendlayout and resumelayout before and after the adding but that did nothing to help the issue

below is a sample of code with some dummy data :)

Code:

        Dim des As String
        Dim disprice As Decimal

        des = banana
        disprice = 2.50

        Dim qwe As New FlowLayoutPanel
        Dim lbl As New Label
        Dim lbl2 As New Label
        Dim lbl3 As New Label

        lbl.BackColor = Color.Transparent
        lbl.Text = des
        lbl.Font = New Font("Lucida Handwriting", 14)
        lbl.ForeColor = Color.White
        lbl.Size = New Size(220, 28)
        lbl.TextAlign = ContentAlignment.MiddleLeft
        AddHandler lbl.Click, AddressOf Me.lineclick

        lbl2.BackColor = Color.Transparent
        lbl2.Text = "1"
        lbl2.Font = New Font("Lucida Handwriting", 14)
        lbl2.ForeColor = Color.White
        lbl2.Size = New Size(85, 28)
        lbl2.TextAlign = ContentAlignment.MiddleCenter
        AddHandler lbl2.Click, AddressOf Me.lineclick
       
        lbl3.BackColor = Color.Transparent
        lbl3.Text = disprice
        lbl3.Font = New Font("Lucida Handwriting", 14)
        lbl3.ForeColor = Color.White
        lbl3.Size = New Size(106, 28)
        lbl3.TextAlign = ContentAlignment.MiddleRight
        AddHandler lbl3.Click, AddressOf Me.lineclick
       
        qwe.BackColor = Color.Transparent
        qwe.Size = New Size(445, 28)

        FlowLayoutPanel10.Controls.Add(qwe)
        qwe.Controls.Add(lbl)
        qwe.Controls.Add(lbl2)
        qwe.Controls.Add(lbl3)

thanks

Viewing all articles
Browse latest Browse all 27199

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>